TANestedTensors

class torchaug.ta_tensors.nested.TANestedTensors(tensors)[source]

TANestedTensors is a generic class to handle nested tensors.

A nested tensor is a list of tensors with the same device, dtype, and number of dimensions.

Parameters:

tensors (Sequence[TypeVar(T, Image, Video, Labels, BoundingBoxes, Mask, Tensor)]) – The sequence of tensors to nest.

Returns:

_description_

add(other)[source]

Add a tensor or a scalar to the nested tensors.

Return type:

Self

add_(other)[source]

Add a tensor or a scalar to the nested tensors in-place.

Return type:

Self

property batch_size: int

Return the batch size of the nested tensors.

clone(memory_format=None)[source]

Return a deep copy of the nested tensors.

Return type:

Self

count(tensor)[source]

Return the number of occurrences of a tensor in the nested tensors.

Return type:

int

property device: device

Return the device of the nested tensors.

div(other)[source]

Divide the nested tensors by a tensor or a scalar.

Return type:

Self

div_(other)[source]

Divide the nested tensors by a tensor or a scalar in-place.

Return type:

Self

property dtype: dtype

Return the dtype of the nested tensors.

floor_divide(other)[source]

Floor divide the nested tensors by a tensor or a scalar.

Return type:

Self

floor_divide_(other)[source]

Floor divide the nested tensors by a tensor or a scalar in-place.

Return type:

Self

index(tensor)[source]

Return the index of a tensor in the nested tensors.

Return type:

int

mul(other)[source]

Multiply a tensor or a scalar to the nested tensors.

Return type:

Self

mul_(other)[source]

Multiply a tensor or a scalar to the nested tensors in-place.

Return type:

Self

property ndim: int

Return the number of dimensions of the nested tensors.

pin_memory(device=None)[source]

Pin the memory of the nested tensors.

Return type:

Self

remainder(other)[source]

Return the remainder of the nested tensors by a tensor or a scalar.

Return type:

Self

remainder_(other)[source]

Return the remainder of the nested tensors by a tensor or a scalar in-place.

Return type:

Self

property shapes: List[Size]

Return the shapes of the tensors.

size(dim=None)[source]

Return the size of the nested tensors.

Return type:

List[Size]

sub(other)[source]

Subtract a tensor or a scalar to the nested tensors.

Return type:

Self

sub_(other)[source]

Subtract a tensor or a scalar to the nested tensors in-place.

Return type:

Self

to(device=None, dtype=None, non_blocking=False, copy=False, *, memory_format=None)[source]

Move the nested tensors to a new device and/or dtype.

Return type:

Self

to_batch()[source]

Return the batched tensor and the shapes of the nested tensors.

Return type:

TypeVar(BATCH_T, BatchImages, BatchBoundingBoxes, BatchLabels, BatchMasks, BatchVideos, Tensor)

to_list()[source]

Return the nested tensors as a list.

Return type:

List[TypeVar(T, Image, Video, Labels, BoundingBoxes, Mask, Tensor)]