Skip to content

tensorplay._C

The C extension module of tensorplay

Classes

class DType

python
DType(*values)

Bases: Enum

class Device

python
Device(*args, **kwargs)

class DeviceType

python
DeviceType(*values)

Bases: Enum

class Generator

python
Generator(*args, **kwargs)

class Node

python
Node(*args, **kwargs)

class Scalar

python
Scalar(*args, **kwargs)

class Size

python
Size(*args, **kwargs)

class TensorBase

python
TensorBase(*args, **kwargs)
Methods

cpu(self) [source]

Returns a copy of this object in CPU memory. If this object is already in CPU memory, then no copy is performed and the original object is returned.


cuda(self, device=None, non_blocking=False) [source]

Returns a copy of this object in CUDA memory. If this object is already in CUDA memory and on the correct device, then no copy is performed and the original object is returned.


double(self) [source]


flatten(self, start_dim=0, end_dim=-1) [source]

Flattens a contiguous range of dims.


float(self) [source]


int(self) [source]


is_float(self) -> bool [source]

Check if tensor is floating point.


long(self) [source]


ndimension(self) -> int [source]

Alias for dim()


t(self) [source]

Returns the transpose of the tensor. Aliased to transpose(0, 1) to ensure correct autograd behavior (TransposeBackward).


type(self, dtype=None, non_blocking=False, **kwargs) [source]

Returns the type if dtype is not provided, else casts this object to the specified type.


unflatten(self, dim, sizes) [source]

Expands a dimension of the input tensor over multiple dimensions.


Released under the Apache 2.0 License.

📚DeepWiki