torch_tensor_negative Function

public function torch_tensor_negative(tensor) result(output)

Overloads negative operator for a single tensor.

Arguments

Type IntentOptional Attributes Name
type(torch_tensor), intent(in) :: tensor

Return Value type(torch_tensor)


Source Code

  function torch_tensor_negative(tensor) result(output)
    type(torch_tensor), intent(in) :: tensor
    type(torch_tensor) :: output

    interface
      function torch_tensor_negative_c(tensor_c) result(output_c)  &
          bind(c, name = 'torch_tensor_negative')
        use, intrinsic :: iso_c_binding, only : c_ptr
        implicit none
        type(c_ptr), value, intent(in) :: tensor_c
        type(c_ptr) :: output_c
      end function torch_tensor_negative_c
    end interface

    output%p = torch_tensor_negative_c(tensor%p)
  end function torch_tensor_negative