Skip to content

tensor

Classes

AirTensor

AIR tensor representation.

Attributes

data property writable
data: NDArray | None

Return the data of the tensor.

size property
size: int

Return the size of the tensor.

nbytes property
nbytes: int

Return the number of bytes in the tensor.

ndim property
ndim: int

Return the number of dimensions of the tensor.

is_constant property
is_constant: bool

Check if the tensor is a constant.

is_persistent property
is_persistent: bool

Check if the tensor is a persistent variable.

is_scratch property
is_scratch: bool

Check if the tensor is a scratch tensor.

ctype property
ctype: str

Return the C type of the tensor.

This is used for generating C code that operates on the tensor. For example, if the tensor is of type int16, the C type will be int16_t.

dtype_alignment_floor property
dtype_alignment_floor: int

Return the alignment floor based on the tensor's dtype.

Functions

get_shape_nhwc
get_shape_nhwc(pre: bool = True) -> tuple[int, int, int, int]

Return a NHWC padded shape tuple, padding missing axes with 1.