ftorch_tensor Module

Module for the FTorch torch_tensor type and associated procedures. Generated from ftorch_tensor.fypp using the fypp Fortran preprocessor.

  • License FTorch is released under an MIT license. See the LICENSE file for details.

Uses

  • module~~ftorch_tensor~~UsesGraph module~ftorch_tensor ftorch_tensor iso_c_binding iso_c_binding module~ftorch_tensor->iso_c_binding iso_fortran_env iso_fortran_env module~ftorch_tensor->iso_fortran_env module~ftorch_devices ftorch_devices module~ftorch_tensor->module~ftorch_devices module~ftorch_types ftorch_types module~ftorch_tensor->module~ftorch_types module~ftorch_devices->iso_fortran_env

Used by

  • module~~ftorch_tensor~~UsedByGraph module~ftorch_tensor ftorch_tensor module~ftorch ftorch module~ftorch->module~ftorch_tensor module~ftorch_loss ftorch_loss module~ftorch->module~ftorch_loss module~ftorch_model ftorch_model module~ftorch->module~ftorch_model module~ftorch_optim ftorch_optim module~ftorch->module~ftorch_optim module~ftorch_loss->module~ftorch_tensor module~ftorch_model->module~ftorch_tensor module~ftorch_optim->module~ftorch_tensor

Interfaces

public interface assignment (=)

  • public subroutine torch_tensor_assign(output, input)

    Overloads assignment operator for tensors.

    Arguments

    Type IntentOptional Attributes Name
    type(torch_tensor), intent(inout) :: output

    Tensor to assign values to

    type(torch_tensor), intent(in) :: input

    Tensor whose values are to be used

public interface operator (*)

  • public function torch_tensor_multiply(tensor1, tensor2) result(output)

    Overloads multiplication operator for two tensors.

    Arguments

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

    First tensor to be multiplied

    type(torch_tensor), intent(in) :: tensor2

    Second tensor to be multiplied

    Return Value type(torch_tensor)

    Tensor to hold the product

public interface operator (**)

  • public function torch_tensor_power_int8(tensor, power) result(output)

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

    Arguments

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

    Tensor to take the power of

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

    Integer exponent

    Return Value type(torch_tensor)

    Tensor to hold the exponentiation

  • public function torch_tensor_power_int16(tensor, power) result(output)

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

    Arguments

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

    Tensor to take the power of

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

    Integer exponent

    Return Value type(torch_tensor)

    Tensor to hold the exponentiation

  • public function torch_tensor_power_int32(tensor, power) result(output)

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

    Arguments

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

    Tensor to take the power of

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

    Integer exponent

    Return Value type(torch_tensor)

    Tensor to hold the exponentiation

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

    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

  • public function torch_tensor_power_real32(tensor, power) result(output)

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

    Arguments

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

    Tensor to take the power of

    real(kind=real32), intent(in), target :: power

    Floating point exponent

    Return Value type(torch_tensor)

    Tensor to hold the exponentiation

  • public function torch_tensor_power_real64(tensor, power) result(output)

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

    Arguments

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

    Tensor to take the power of

    real(kind=real64), intent(in), target :: power

    Floating point exponent

    Return Value type(torch_tensor)

    Tensor to hold the exponentiation

public interface operator (+)

  • public function torch_tensor_add(tensor1, tensor2) result(output)

    Overloads addition operator for two tensors.

    Arguments

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

    First tensor to be added

    type(torch_tensor), intent(in) :: tensor2

    Second tensor to be added

    Return Value type(torch_tensor)

    Tensor to hold the sum

public interface operator (-)

  • 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

    Tensor to take the negative of

    Return Value type(torch_tensor)

    Tensor to hold the negative values

  • public function torch_tensor_subtract(tensor1, tensor2) result(output)

    Overloads subtraction operator for two tensors.

    Arguments

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

    First tensor for the subtraction

    type(torch_tensor), intent(in) :: tensor2

    Second tensor for the subtraction

    Return Value type(torch_tensor)

    Tensor to hold the difference

public interface operator (/)

  • public function torch_tensor_divide(tensor1, tensor2) result(output)

    Overloads division operator for two tensors.

    Arguments

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

    First tensor for the division

    type(torch_tensor), intent(in) :: tensor2

    Second tensor for the division

    Return Value type(torch_tensor)

    Tensor to hold the quotient

interface

  • public function torch_from_blob_c(data, ndims, tensor_shape, strides, dtype, device_type, device_index, requires_grad) result(tensor_p) bind(c, name = "torch_from_blob")

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), intent(in), value :: data
    integer(kind=c_int), intent(in), value :: ndims
    integer(kind=c_int64_t), intent(in) :: tensor_shape(*)
    integer(kind=c_int64_t), intent(in) :: strides(*)
    integer(kind=c_int), intent(in), value :: dtype
    integer(kind=c_int), intent(in), value :: device_type
    integer(kind=c_int), intent(in), value :: device_index
    logical(kind=c_bool), intent(in), value :: requires_grad

    Return Value type(c_ptr)

public interface torch_tensor_backward

  • public subroutine torch_tensor_backward_with_external_gradient(tensor, external_gradient, retain_graph)

    Performs back-propagation on a Torch Tensor, given some external gradient.

    Arguments

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

    Tensor to compute gradients of

    type(torch_tensor), intent(in) :: external_gradient

    External tensor used as an initial scaling of the gradient calculation

    logical, intent(in), optional :: retain_graph

    Should the computational graph be retained?

  • public subroutine torch_tensor_backward_without_external_gradient(tensor, retain_graph)

    Performs back-propagation on a Torch Tensor, with an assumed external_gradient of ones.

    Arguments

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

    Tensor to compute gradients of

    logical, intent(in), optional :: retain_graph

    Should the computational graph be retained?

interface

  • public subroutine torch_tensor_divide_c(output_c, tensor1_c, tensor2_c) bind(c, name = "torch_tensor_divide")

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), intent(in), value :: output_c
    type(c_ptr), intent(in), value :: tensor1_c
    type(c_ptr), intent(in), value :: tensor2_c

public interface torch_tensor_from_array

Interface for directing torch_tensor_from_array to possible input types and ranks Signature: (tensor, data, device_type, [device_index], [permute_dims], [requires_grad])

  • public subroutine torch_tensor_from_array_int8_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 1 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(1)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int8_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 2 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(2)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int8_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 3 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(3)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int8_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 4 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(4)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int8_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 5 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(5)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 1 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(1)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 2 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(2)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 3 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(3)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 4 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(4)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 5 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(5)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 1 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(1)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 2 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(2)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 3 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(3)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 4 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(4)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 5 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(5)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 1 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(1)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 2 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(2)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 3 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(3)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 4 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(4)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 5 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(5)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 1 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(1)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 2 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(2)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 3 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(3)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 4 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(4)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 5 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(5)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 1 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(1)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 2 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(2)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 3 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(3)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 4 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(4)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

    Return a Torch tensor pointing to data_in array of rank 5 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    integer(kind=int32), intent(in), optional :: permute_dims(5)

    Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

public interface torch_tensor_from_array_legacy Deprecated

This is the old layout-required signature for torch_tensor_from_array: (tensor, data, layout, device_type, [device_index], [requires_grad]). Use torch_tensor_from_array instead. This will be removed in a future release.

  • public subroutine torch_tensor_from_array_int8_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(1)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int8_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(2)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int8_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(3)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int8_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(4)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int8_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(5)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(1)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(2)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(3)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(4)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int16_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(5)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(1)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(2)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(3)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(4)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int32_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(5)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(1)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(2)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(3)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(4)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_int64_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(5)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(1)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(2)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(3)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(4)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real32_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(5)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(1)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(2)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(3)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(4)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

  • public subroutine torch_tensor_from_array_real64_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

    This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

    Arguments

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

    Returned tensor

    real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

    Input data that tensor will point at

    integer(kind=int32), intent(in) :: layout(5)

    Control order of indices

    integer(kind=c_int), intent(in) :: device_type

    Device type the tensor will live on (torch_kCPU or a GPU device type)

    integer, intent(in), optional :: device_index

    Device index for GPU devices

    logical, intent(in), optional :: requires_grad

    Whether gradients need to be computed for the created tensor

interface

  • public subroutine torch_tensor_multiply_c(output_c, tensor1_c, tensor2_c) bind(c, name = "torch_tensor_multiply")

    Arguments

    Type IntentOptional Attributes Name
    type(c_ptr), intent(in), value :: output_c
    type(c_ptr), intent(in), value :: tensor1_c
    type(c_ptr), intent(in), value :: tensor2_c

Derived Types

type, public ::  torch_tensor

Type for holding a Torch tensor.

Components

Type Visibility Attributes Name Initial
type(c_ptr), public :: p = c_null_ptr

pointer to the tensor in memory

Finalizations Procedures

final :: torch_tensor_delete

Type-Bound Procedures

procedure, public :: device_index => torch_tensor_get_device_index
procedure, public :: device_type => torch_tensor_get_device_type
procedure, public :: dtype => torch_tensor_get_dtype
procedure, public :: print => torch_tensor_print
procedure, public :: rank => torch_tensor_get_rank
procedure, public :: requires_grad => torch_tensor_requires_grad
procedure, public :: shape => torch_tensor_get_shape
procedure, public :: stride => torch_tensor_get_stride
procedure, public :: zero => torch_tensor_zero
procedure, public :: zero_grad => torch_tensor_zero_grad

Functions

public function torch_tensor_add(tensor1, tensor2) result(output)

Overloads addition operator for two tensors.

Arguments

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

First tensor to be added

type(torch_tensor), intent(in) :: tensor2

Second tensor to be added

Return Value type(torch_tensor)

Tensor to hold the sum

public function torch_tensor_divide(tensor1, tensor2) result(output)

Overloads division operator for two tensors.

Arguments

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

First tensor for the division

type(torch_tensor), intent(in) :: tensor2

Second tensor for the division

Return Value type(torch_tensor)

Tensor to hold the quotient

public function torch_tensor_get_device_index(self) result(device_index)

Determines the device index of a tensor.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(in) :: self

Tensor to get the device index of

Return Value integer(kind=c_int)

Device index of tensor

public function torch_tensor_get_device_type(self) result(device_type)

Returns the device type of a tensor.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(in) :: self

Tensor to get the device type of

Return Value integer(kind=c_int)

Device type of tensor

public function torch_tensor_get_dtype(self) result(dtype)

Returns the data type of a tensor.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(in) :: self

Tensor to get the data type of

Return Value integer(kind=c_int)

Data type of tensor

public function torch_tensor_get_rank(self) result(rank)

Determines the rank of a tensor.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(in) :: self

Tensor to get the rank of

Return Value integer(kind=int32)

Rank of tensor

public function torch_tensor_get_shape(self) result(sizes)

Determines the shape of a tensor.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(in) :: self

Tensor to get the shape of

Return Value integer(kind=int64), allocatable, (:)

Array holding the shape of the tensor

public function torch_tensor_get_stride(self) result(strides)

Return the strides of the tensor

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(in) :: self

Tensor to get the strides of

Return Value integer(kind=int64), allocatable, (:)

Array holding the strides of the tensor

public function torch_tensor_multiply(tensor1, tensor2) result(output)

Overloads multiplication operator for two tensors.

Arguments

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

First tensor to be multiplied

type(torch_tensor), intent(in) :: tensor2

Second tensor to be multiplied

Return Value type(torch_tensor)

Tensor to hold the product

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

Tensor to take the negative of

Return Value type(torch_tensor)

Tensor to hold the negative values

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

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

Arguments

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

Tensor to take the power of

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

Integer exponent

Return Value type(torch_tensor)

Tensor to hold the exponentiation

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

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

Arguments

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

Tensor to take the power of

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

Integer exponent

Return Value type(torch_tensor)

Tensor to hold the exponentiation

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

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

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

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

Arguments

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

Tensor to take the power of

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

Integer exponent

Return Value type(torch_tensor)

Tensor to hold the exponentiation

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

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

Arguments

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

Tensor to take the power of

real(kind=real32), intent(in), target :: power

Floating point exponent

Return Value type(torch_tensor)

Tensor to hold the exponentiation

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

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

Arguments

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

Tensor to take the power of

real(kind=real64), intent(in), target :: power

Floating point exponent

Return Value type(torch_tensor)

Tensor to hold the exponentiation

public function torch_tensor_requires_grad(self) result(requires_grad)

Determines whether a tensor requires the autograd module.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(in) :: self

Tensor to query

Return Value logical

Whether the tensor requires autograd

public function torch_tensor_subtract(tensor1, tensor2) result(output)

Overloads subtraction operator for two tensors.

Arguments

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

First tensor for the subtraction

type(torch_tensor), intent(in) :: tensor2

Second tensor for the subtraction

Return Value type(torch_tensor)

Tensor to hold the difference


Subroutines

public subroutine torch_tensor_assign(output, input)

Overloads assignment operator for tensors.

Arguments

Type IntentOptional Attributes Name
type(torch_tensor), intent(inout) :: output

Tensor to assign values to

type(torch_tensor), intent(in) :: input

Tensor whose values are to be used

public subroutine torch_tensor_backward_with_external_gradient(tensor, external_gradient, retain_graph)

Performs back-propagation on a Torch Tensor, given some external gradient.

Arguments

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

Tensor to compute gradients of

type(torch_tensor), intent(in) :: external_gradient

External tensor used as an initial scaling of the gradient calculation

logical, intent(in), optional :: retain_graph

Should the computational graph be retained?

public subroutine torch_tensor_backward_without_external_gradient(tensor, retain_graph)

Performs back-propagation on a Torch Tensor, with an assumed external_gradient of ones.

Arguments

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

Tensor to compute gradients of

logical, intent(in), optional :: retain_graph

Should the computational graph be retained?

public impure elemental subroutine torch_tensor_delete(tensor)

Deallocates a tensor (elemental). Note: Marked as impure due to C interoperability, though the operation is conceptally pure (deletion of a specific C++ Tensor object).

Arguments

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

Tensor to deallocate

public subroutine torch_tensor_empty(tensor, ndims, tensor_shape, dtype, device_type, device_index, requires_grad)

Returns a tensor with uninitialised values.

Arguments

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

Returned tensor

integer(kind=int32), intent(in) :: ndims

Number of dimensions of the tensor

integer(kind=int64), intent(in) :: tensor_shape(ndims)

Shape of the tensor

integer(kind=c_int), intent(in) :: dtype

Data type of the tensor

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 1 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(1)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(1)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 2 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(2)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(2)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 3 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(3)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(3)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 4 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(4)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(4)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 5 containing data of type int16 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(5)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int16_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int16), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(5)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 1 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(1)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(1)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 2 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(2)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(2)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 3 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(3)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(3)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 4 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(4)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(4)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 5 containing data of type int32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(5)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int32_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int32), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(5)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 1 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(1)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(1)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 2 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(2)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(2)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 3 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(3)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(3)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 4 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(4)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(4)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 5 containing data of type int64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(5)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int64_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int64), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(5)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 1 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(1)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(1)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 2 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(2)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(2)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 3 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(3)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(3)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 4 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(4)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(4)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 5 containing data of type int8 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(5)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_int8_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

integer(kind=int8), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(5)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 1 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(1)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(1)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 2 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(2)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(2)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 3 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(3)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(3)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 4 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(4)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(4)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 5 containing data of type real32 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(5)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real32_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real32), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(5)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_1d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 1 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(1)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_1d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(1)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_2d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 2 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(2)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_2d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(2)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_3d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 3 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(3)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_3d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(3)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_4d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 4 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(4)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_4d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(4)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_5d(tensor, data_in, device_type, device_index, permute_dims, requires_grad)

Return a Torch tensor pointing to data_in array of rank 5 containing data of type real64 This subroutine is part of an interface and should be accessed through torch_tensor_from_array.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

integer(kind=int32), intent(in), optional :: permute_dims(5)

Permutation of dimensions to be applied to Fortran data in the resulting tensor. Takes the form of an array of length n with elements 1 to n, where n is the rank. Element i indicates which dimension of the Fortran array appears as dimension i on the Torch tensor. e.g. a Fortran array of shape [10, 20, 30] permuted by [2, 3, 1] will result in Torch shape [20, 30, 10]. This matches behaviour of torch.permute(), noting that this is Fortran so we index from 1!

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_array_real64_5d_legacy(tensor, data_in, layout, device_type, device_index, requires_grad) Deprecated

This is the old layout-required signature for torch_tensor_from_array. Use torch_tensor_from_array instead. This will be removed in a future release.

Arguments

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

Returned tensor

real(kind=real64), intent(in), pointer, contiguous :: data_in(:,:,:,:,:)

Input data that tensor will point at

integer(kind=int32), intent(in) :: layout(5)

Control order of indices

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_from_blob(tensor, data, ndims, tensor_shape, tensor_strides, dtype, device_type, device_index, requires_grad)

Exposes the given data as a tensor without taking ownership of the original data. This routine will take an array in memory and return a tensor as specified by the shape and stride input arguments.

Read more…

Arguments

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

Returned tensor

type(c_ptr), intent(in) :: data

Pointer to data

integer(kind=int32), intent(in) :: ndims

Number of dimensions of the tensor

integer(kind=int64), intent(in) :: tensor_shape(ndims)

Shape of the returned tensor

integer(kind=int64), intent(in) :: tensor_strides(ndims)

Strides for accessing data in the returned tensor. Note that these are integers representing the number of items of type dtype and NOT bytes/memory.

integer(kind=c_int), intent(in) :: dtype

Data type of the input data and tensor

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_get_gradient(gradient, tensor)

Retrieves the gradient with respect to a Torch Tensor.

Arguments

Type IntentOptional Attributes Name
type(torch_tensor), intent(inout) :: gradient

Tensor holding the gradient

type(torch_tensor), intent(in) :: tensor

Tensor to compute the gradient with respect to

public subroutine torch_tensor_mean(output, tensor)

Overloads mean operator over the values in a tensor.

Arguments

Type IntentOptional Attributes Name
type(torch_tensor), intent(inout) :: output

Tensor holding the averaged values

type(torch_tensor), intent(in) :: tensor

Tensor to average the values of

public subroutine torch_tensor_ones(tensor, ndims, tensor_shape, dtype, device_type, device_index, requires_grad)

Returns a tensor filled with the scalar value 1.

Arguments

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

Returned tensor

integer(kind=int32), intent(in) :: ndims

Number of dimensions of the tensor

integer(kind=int64), intent(in) :: tensor_shape(ndims)

Shape of the tensor

integer(kind=c_int), intent(in) :: dtype

Data type of the tensor

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor

public subroutine torch_tensor_print(self)

Prints the contents of a tensor.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(in) :: self

Tensor to print the contents of

public subroutine torch_tensor_sum(output, tensor)

Overloads summation operator over the values in a tensor.

Arguments

Type IntentOptional 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

public subroutine torch_tensor_to(source_tensor, target_tensor, non_blocking)

Moves a source_tensor tensor to a target tensor's device and dtype

Arguments

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

Source tensor to be moved

type(torch_tensor), intent(inout) :: target_tensor

Target tensor with the desired device and dtype

logical, intent(in), optional :: non_blocking

Whether to perform asynchronous copy

public subroutine torch_tensor_zero(tensor)

Fills a tensor with the scalar value 0.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(inout) :: tensor

Tensor whose values are to be zeroed

public subroutine torch_tensor_zero_grad(tensor)

Resets a tensor's gradient to zero.

Arguments

Type IntentOptional Attributes Name
class(torch_tensor), intent(inout) :: tensor

Tensor to zero the gradient of

public subroutine torch_tensor_zeros(tensor, ndims, tensor_shape, dtype, device_type, device_index, requires_grad)

Returns a tensor filled with the scalar value 0.

Arguments

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

Returned tensor

integer(kind=int32), intent(in) :: ndims

Number of dimensions of the tensor

integer(kind=int64), intent(in) :: tensor_shape(ndims)

Shape of the tensor

integer(kind=c_int), intent(in) :: dtype

Data type of the tensor

integer(kind=c_int), intent(in) :: device_type

Device type the tensor will live on (torch_kCPU or a GPU device type)

integer, intent(in), optional :: device_index

Device index for GPU devices

logical, intent(in), optional :: requires_grad

Whether gradients need to be computed for the created tensor