Overloads summation operator over the values in a tensor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(torch_tensor), | intent(inout) | :: | output |
Tensor holding the summed values |
||
type(torch_tensor), | intent(in) | :: | tensor |
Tensor to sum the values of |
subroutine torch_tensor_sum(output, tensor) use, intrinsic :: iso_c_binding, only : c_associated type(torch_tensor), intent(inout) :: output !! Tensor holding the summed values type(torch_tensor), intent(in) :: tensor !! Tensor to sum the values of interface subroutine torch_tensor_sum_c(output_c, tensor_c) & bind(c, name = 'torch_tensor_sum') use, intrinsic :: iso_c_binding, only : c_ptr implicit none type(c_ptr), value, intent(in) :: output_c type(c_ptr), value, intent(in) :: tensor_c end subroutine torch_tensor_sum_c end interface if (.not. c_associated(output%p)) then write(*,*) "Error :: output tensor has not been constructed" stop 1 end if call torch_tensor_sum_c(output%p, tensor%p) end subroutine torch_tensor_sum