Get the attributes of the Duvenaud message passing layer (for ONNX export)
Exports hyperparameters needed to reconstruct the layer architecture: - num_time_steps: number of message passing iterations - min_vertex_degree, max_vertex_degree: degree bucket range - num_vertex_features: vertex feature dimensions per time step - num_edge_features: edge feature dimensions per time step - num_outputs: readout output dimension - message_activation, readout_activation: activation function names
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(duvenaud_msgpass_layer_type), | intent(in) | :: | this |
Instance of the layer |
Attributes of the layer
function get_attributes_duvenaud(this) result(attributes) !! Get the attributes of the Duvenaud message passing layer (for ONNX export) !! !! Exports hyperparameters needed to reconstruct the layer architecture: !! - num_time_steps: number of message passing iterations !! - min_vertex_degree, max_vertex_degree: degree bucket range !! - num_vertex_features: vertex feature dimensions per time step !! - num_edge_features: edge feature dimensions per time step !! - num_outputs: readout output dimension !! - message_activation, readout_activation: activation function names implicit none ! Arguments class(duvenaud_msgpass_layer_type), intent(in) :: this !! Instance of the layer type(onnx_attribute_type), allocatable, dimension(:) :: attributes !! Attributes of the layer ! Local variables integer :: t !! Time-step index character(256) :: buffer !! Buffer for integer-to-string conversion allocate(attributes(7)) write(buffer, '(I0)') this%num_time_steps attributes(1) = onnx_attribute_type( & name='num_time_steps', type='int', val=trim(buffer)) write(buffer, '(I0)') this%min_vertex_degree attributes(2) = onnx_attribute_type( & name='min_vertex_degree', type='int', val=trim(buffer)) write(buffer, '(I0)') this%max_vertex_degree attributes(3) = onnx_attribute_type( & name='max_vertex_degree', 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(4) = onnx_attribute_type( & name='num_vertex_features', type='ints', val=trim(buffer)) buffer = '' do t = 0, this%num_time_steps if(t .eq. 0)then write(buffer, '(I0)') this%num_edge_features(t) else write(buffer, '(A," ",I0)') trim(buffer), this%num_edge_features(t) end if end do attributes(5) = onnx_attribute_type( & name='num_edge_features', type='ints', val=trim(buffer)) write(buffer, '(I0)') this%num_outputs attributes(6) = onnx_attribute_type( & name='num_outputs', type='int', val=trim(buffer)) attributes(7) = onnx_attribute_type( & name='message_activation', type='string', & val=trim(this%activation%name)) end function get_attributes_duvenaud