Update the message
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(kipf_msgpass_layer_type), | intent(inout), | target | :: | this |
Instance of the message passing layer |
|
| class(array_type), | intent(in), | dimension(:,:), target | :: | input |
Input to the message passing layer |
subroutine update_message_kipf(this, input) !! Update the message implicit none ! Arguments class(kipf_msgpass_layer_type), intent(inout), target :: this !! Instance of the message passing layer class(array_type), dimension(:,:), intent(in), target :: input !! Input to the message passing layer ! Local variables integer :: s, t !! Batch index, time step type(array_type), pointer :: ptr1, ptr2, ptr3 !! Pointers to arrays if(allocated(this%output))then if(size(this%output,2).ne.size(input,2))then deallocate(this%output) allocate(this%output(1,size(input,2))) end if else allocate(this%output(1,size(input,2))) end if do s = 1, size(input,2) ptr1 => input(1,s) do t = 1, this%num_time_steps ptr2 => kipf_propagate( & ptr1, & this%graph(s)%adj_ia, this%graph(s)%adj_ja & ) ! this%z(t,s) = kipf_update( & ! this%message(t,s), this%params(t), this%graph(s)%adj_ia & ! ) ptr3 => matmul( this%params(t), ptr2 ) ptr1 => this%activation%apply( ptr3 ) end do call this%output(1,s)%zero_grad() call this%output(1,s)%assign_and_deallocate_source(ptr1) this%output(1,s)%is_temporary = .false. end do end subroutine update_message_kipf