Propagate values from one autodiff array to another
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in), | target | :: | vertex_features |
Vertex feature tensor |
|
| integer, | intent(in), | dimension(:) | :: | adj_ia |
CSR row pointers |
|
| integer, | intent(in), | dimension(:,:) | :: | adj_ja |
CSR neighbour and edge lookup indices |
Propagated node feature tensor
module function kipf_propagate(vertex_features, adj_ia, adj_ja) result(c) !! Propagate values from one autodiff array to another implicit none ! Arguments class(array_type), intent(in), target :: vertex_features !! Vertex feature tensor integer, dimension(:), intent(in) :: adj_ia !! CSR row pointers integer, dimension(:,:), intent(in) :: adj_ja !! CSR neighbour and edge lookup indices type(array_type), pointer :: c !! Propagated node feature tensor ! Local variables integer :: v, w !! Vertex and adjacency traversal indices real(real32) :: coeff !! Symmetric normalisation coefficient per edge c => vertex_features%create_result() ! propagate 1D array by using shape to swap dimensions do concurrent(v = 1:size(vertex_features%val,2)) c%val(:,v) = 0._real32 do w = adj_ia(v), adj_ia(v+1)-1 ! if( adj_ja(2,w) .eq. 0 )then ! coeff = 1._real32 ! !else ! ! coeff = edge_weights(adj_ja(2,w)) ! end if !coeff = coeff * ( & coeff = ( & ( adj_ia(v+1) - adj_ia(v) ) * & ( adj_ia( adj_ja(1,w) + 1 ) - adj_ia( adj_ja(1,w) ) ) & ) ** ( -0.5_real32 ) c%val(:,v) = c%val(:,v) + coeff * [ vertex_features%val(:, adj_ja(1, w)) ] end do end do c%indices = adj_ia c%adj_ja = adj_ja c%get_partial_left => get_partial_kipf_propagate_left c%get_partial_left_val => get_partial_kipf_propagate_left_val if(vertex_features%requires_grad)then c%requires_grad = .true. c%is_forward = vertex_features%is_forward c%operation = 'kipf_propagate' c%left_operand => vertex_features c%owns_left_operand = vertex_features%is_temporary end if end function kipf_propagate