get_attributes_kipf Function

private function get_attributes_kipf(this) result(attributes)

Get the attributes of the Kipf GCN layer (for ONNX export)

Type Bound

kipf_msgpass_layer_type

Arguments

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

Instance of the message passing layer

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

Attributes for ONNX export


Source Code

  function get_attributes_kipf(this) result(attributes)
    !! Get the attributes of the Kipf GCN layer (for ONNX export)
    implicit none

    ! Arguments
    class(kipf_msgpass_layer_type), intent(in) :: this
    !! Instance of the message passing layer
    type(onnx_attribute_type), allocatable, dimension(:) :: attributes
    !! Attributes for ONNX export

    ! Local variables
    integer :: t
    !! Loop index
    character(256) :: buffer
    !! Buffer for converting attributes to strings

    allocate(attributes(3))

    write(buffer, '(I0)') this%num_time_steps
    attributes(1) = onnx_attribute_type( &
         name='num_time_steps', type='int', val=trim(buffer))

    buffer = ''
    do t = 0, this%num_time_steps
       if(t .eq. 0)then
          write(buffer, '(I0)') this%num_vertex_features(t)
       else
          write(buffer, '(A," ",I0)') trim(buffer), this%num_vertex_features(t)
       end if
    end do
    attributes(2) = onnx_attribute_type( &
         name='num_vertex_features', type='ints', val=trim(buffer))

    attributes(3) = onnx_attribute_type( &
         name='message_activation', type='string', &
         val=trim(this%activation%name))

  end function get_attributes_kipf