torch_tensor Derived Type

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


Type-Bound Procedures

procedure, public :: get_rank

  • public function get_rank(self) result(rank)

    Determines the rank of a tensor.

    Arguments

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

    Return Value integer(kind=int32)

    rank of tensor

procedure, public :: get_shape

  • public function get_shape(self) result(sizes)

    Determines the shape of a tensor.

    Arguments

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

    Return Value integer(kind=c_long), pointer, (:)

    Pointer to tensor data

Source Code

  type torch_tensor
    type(c_ptr) :: p = c_null_ptr  !! pointer to the tensor in memory
  contains
    procedure :: get_rank
    procedure :: get_shape
  end type torch_tensor