Set input values for an input layer
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(input_layer_type), | intent(inout) | :: | this |
Instance of the input layer |
||
| type(graph_type), | intent(in), | dimension(:) | :: | input |
Input data |
subroutine set_input_graph(this, input) !! Set input values for an input layer implicit none ! Arguments class(input_layer_type), intent(inout) :: this !! Instance of the input layer type(graph_type), dimension(:), intent(in) :: input !! Input data integer :: s if(allocated(this%output))then if(any(shape(this%output).ne.[2,size(input)]))then deallocate(this%output) allocate(this%output(2,size(input))) end if else allocate(this%output(2,size(input))) end if do s = 1, size(input) if(this%output(1,s)%allocated) call this%output(1,s)%deallocate() if(this%output(2,s)%allocated) call this%output(2,s)%deallocate() call this%output(1,s)%allocate( & array_shape = [ & input(s)%num_vertex_features, input(s)%num_vertices & ] & ) call this%output(1,s)%zero_grad() call this%output(1,s)%set_requires_grad(.false.) call this%output(1,s)%set( input(s)%vertex_features ) this%output(1,s)%is_temporary = .false. if(input(s)%num_edge_features.le.0) cycle call this%output(2,s)%allocate( & array_shape = [ & input(s)%num_edge_features, input(s)%num_edges & ] & ) call this%output(2,s)%zero_grad() call this%output(2,s)%set_requires_grad(.false.) call this%output(2,s)%set( input(s)%edge_features ) this%output(2,s)%is_temporary = .false. end do end subroutine set_input_graph