Overloads multiplication operator for a scalar of type int32 and a tensor.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
integer(kind=int32), | intent(in), | target | :: | scalar | ||
type(torch_tensor), | intent(in) | :: | tensor |
function torch_tensor_premultiply_int32(scalar, tensor) result(output) use, intrinsic :: iso_c_binding, only : c_loc use, intrinsic :: iso_fortran_env, only : int32 integer(int32), target, intent(in) :: scalar type(torch_tensor), intent(in) :: tensor type(torch_tensor) :: wrk, output ! Create a tensor with a single entry, the scalar pre-multiplier call torch_tensor_from_array(wrk, [scalar], [1], tensor%get_device_type(), & tensor%get_device_index()) output%p = torch_tensor_multiply_c(wrk%p, tensor%p) end function torch_tensor_premultiply_int32