get_partial_left_reverse_kipf_propagate_val Subroutine

pure subroutine get_partial_left_reverse_kipf_propagate_val(this, upstream_grad, output)

Arguments

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

Forward result node containing saved operands

real(kind=real32), intent(in), dimension(:,:) :: upstream_grad

Upstream gradient values

real(kind=real32), intent(out), dimension(:,:) :: output

Output gradient values for left operand


Source Code

  pure subroutine get_partial_left_reverse_kipf_propagate_val( &
       this, upstream_grad, output &
  )
    implicit none

    ! Arguments
    class(array_type), intent(in) :: this
    !! Forward result node containing saved operands
    real(real32), dimension(:,:), intent(in) :: upstream_grad
    !! Upstream gradient values
    real(real32), dimension(:,:), intent(out) :: output
    !! Output gradient values for left operand

    ! Local variables
    integer :: v, w, i
    !! Loop indices
    output = 0._real32
    do concurrent(v=1:size(upstream_grad,2))
       do w = this%indices(v), this%indices(v+1)-1
          do concurrent(i = 1:size(upstream_grad,1))
             output(i,this%adj_ja(1,w)) = output(i,this%adj_ja(1,w)) + &
                  upstream_grad(i, v)
          end do
       end do
    end do

  end subroutine get_partial_left_reverse_kipf_propagate_val