get_attributes_pool Module Function

module function get_attributes_pool(this) result(attributes)

Get the attributes of a pooling layer (for ONNX export)

Arguments

Type IntentOptional Attributes Name
class(pool_layer_type), intent(in) :: this

Instance of the layer

Return Value type(onnx_attribute_type), allocatable, dimension(:)

Attributes of the layer


Source Code

  module function get_attributes_pool(this) result(attributes)
    !! Get the attributes of a pooling layer (for ONNX export)
    implicit none

    ! Arguments
    class(pool_layer_type), intent(in) :: this
    !! Instance of the layer
    type(onnx_attribute_type), allocatable, dimension(:) :: attributes
    !! Attributes of the layer

    ! Local variables
    character(256) :: buffer, fmt
    !! Buffer for formatting

    ! Allocate attributes array
    allocate(attributes(2))
    attributes(1)%name = "kernel_shape"
    write(fmt,'("(",I0,"(1X,I0))")') size(this%pool)
    write(buffer,fmt) this%pool
    attributes(1)%val = trim(adjustl(buffer))
    attributes(1)%type = "ints"

    attributes(2)%name = "strides"
    write(fmt,'("(",I0,"(1X,I0))")') size(this%strd)
    write(buffer,fmt) this%strd
    attributes(2)%val = trim(adjustl(buffer))
    attributes(2)%type = "ints"

  end function get_attributes_pool