torch_tensor_premultiply_int8 Function

public function torch_tensor_premultiply_int8(scalar, tensor) result(output)

Overloads multiplication operator for a scalar of type int8 and a tensor.

Arguments

Type IntentOptional Attributes Name
integer(kind=int8), intent(in) :: scalar
type(torch_tensor), intent(in) :: tensor

Return Value type(torch_tensor)


Source Code

  function torch_tensor_premultiply_int8(scalar, tensor) result(output)
    integer(kind=int8), intent(in) :: scalar
    type(torch_tensor), intent(in) :: tensor
    type(torch_tensor) :: output

    interface
      function torch_tensor_premultiply_c(scalar_c, tensor_c) result(output_c) &
          bind(c, name = 'torch_tensor_premultiply')
        use, intrinsic :: iso_c_binding, only : c_ptr
        use, intrinsic :: iso_fortran_env, only : int8
        implicit none
        integer(kind=int8), value, intent(in) :: scalar_c
        type(c_ptr), value, intent(in) :: tensor_c
        type(c_ptr) :: output_c
      end function torch_tensor_premultiply_c
    end interface

    output%p = torch_tensor_premultiply_c(scalar, tensor%p)
  end function torch_tensor_premultiply_int8