| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(array_type), | intent(in) | :: | this | |||
| real(kind=real32), | intent(in), | dimension(:,:) | :: | upstream_grad | ||
| real(kind=real32), | intent(out), | dimension(:,:) | :: | output |
pure subroutine get_partial_sum_val(this, upstream_grad, output) implicit none class(array_type), intent(in) :: this real(real32), dimension(:,:), intent(in) :: upstream_grad real(real32), dimension(:,:), intent(out) :: output integer :: i, s, dim, n_rows, n_cols ! Cache values to avoid repeated accesses dim = this%indices(1) n_rows = size(output, 1) n_cols = size(output, 2) if(dim.eq.1)then do concurrent(s = 1:n_cols, i = 1:n_rows) output(i,s) = upstream_grad(1,s) end do else if(dim.eq.2)then do concurrent(s = 1:n_cols, i = 1:n_rows) output(i,s) = upstream_grad(i,1) end do end if end subroutine get_partial_sum_val