torch_tensor_power_int64 Function

public function torch_tensor_power_int64(tensor, power) result(output)

Uses

  • proc~~torch_tensor_power_int64~~UsesGraph proc~torch_tensor_power_int64 torch_tensor_power_int64 iso_c_binding iso_c_binding proc~torch_tensor_power_int64->iso_c_binding iso_fortran_env iso_fortran_env proc~torch_tensor_power_int64->iso_fortran_env

Overloads exponentiation operator for a tensor and a scalar of type int64

Arguments

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

Tensor to take the power of

integer(kind=int64), intent(in), target :: power

Integer exponent

Return Value type(torch_tensor)

Tensor to hold the exponentiation


Calls

proc~~torch_tensor_power_int64~~CallsGraph proc~torch_tensor_power_int64 torch_tensor_power_int64 proc~torch_tensor_empty torch_tensor_empty proc~torch_tensor_power_int64->proc~torch_tensor_empty proc~torch_tensor_get_device_index torch_tensor%torch_tensor_get_device_index proc~torch_tensor_power_int64->proc~torch_tensor_get_device_index proc~torch_tensor_get_device_type torch_tensor%torch_tensor_get_device_type proc~torch_tensor_power_int64->proc~torch_tensor_get_device_type proc~torch_tensor_get_dtype torch_tensor%torch_tensor_get_dtype proc~torch_tensor_power_int64->proc~torch_tensor_get_dtype proc~torch_tensor_get_rank torch_tensor%torch_tensor_get_rank proc~torch_tensor_power_int64->proc~torch_tensor_get_rank proc~torch_tensor_get_shape torch_tensor%torch_tensor_get_shape proc~torch_tensor_power_int64->proc~torch_tensor_get_shape proc~torch_tensor_requires_grad torch_tensor%torch_tensor_requires_grad proc~torch_tensor_power_int64->proc~torch_tensor_requires_grad proc~torch_tensor_get_shape->proc~torch_tensor_get_rank

Called by

proc~~torch_tensor_power_int64~~CalledByGraph proc~torch_tensor_power_int64 torch_tensor_power_int64 interface~operator (ASTERISKASTERISK) operator (**) interface~operator (ASTERISKASTERISK)->proc~torch_tensor_power_int64

Source Code

  function torch_tensor_power_int64(tensor, power) result(output)
    use, intrinsic :: iso_c_binding, only : c_associated, c_loc
    use, intrinsic :: iso_fortran_env, only : int64
    type(torch_tensor), intent(in) :: tensor                  !! Tensor to take the power of
    integer(int64), target, intent(in) :: power   !! Integer exponent
    type(torch_tensor) :: output                              !! Tensor to hold the exponentiation

    interface
      subroutine torch_tensor_power_int_c(output_c, tensor_c, power_c) &
          bind(c, name = 'torch_tensor_power_int')
        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
        type(c_ptr), value, intent(in) :: power_c
      end subroutine torch_tensor_power_int_c
    end interface

    if (.not. c_associated(output%p)) then
      call torch_tensor_empty(output, tensor%get_rank(), tensor%get_shape(), tensor%get_dtype(), &
                              tensor%get_device_type(), device_index=tensor%get_device_index(), &
                              requires_grad=tensor%requires_grad())
    end if
    call torch_tensor_power_int_c(output%p, tensor%p, c_loc(power))
  end function torch_tensor_power_int64