class tensorstore.IndexTransform

Represents a transform from an input index space to an output space.

The index transform abstraction underlies all indexing operations in the TensorStore library, and enables fully-composable virtual views. For many common use cases cases, however, it does not need to be used directly; instead, it is used indirectly through indexing operations on the TensorStore class and other Indexable types.

See also

Constructors

IndexTransform(input_rank: int | None = None, *, ...)

Constructs an index transform from component vectors.

IndexTransform(domain: IndexDomain, ...)

Constructs an index transform from a domain and output index maps.

IndexTransform(*, json: Any)

Constructs an index transform from its JSON representation.

Accessors

domain : IndexDomain

Input domain of the index transform.

input_rank : int

Rank of the input space.

output_rank : int

Rank of the output space.

ndim : int

Rank of the input space, alias for input_rank.

input_origin : Tuple[int, ...]

Inclusive lower bound of the input domain.

input_inclusive_min : Tuple[int, ...]

Inclusive lower bound of the input domain, alias for input_origin.

input_shape : Tuple[int, ...]

Shape of the input domain.

input_exclusive_max : Tuple[int, ...]

Exclusive upper bound of the input domain.

input_inclusive_max : Tuple[int, ...]

Inclusive upper bound of the input domain.

input_labels : Tuple[str, ...]

Dimension labels for each input dimension.

implicit_lower_bounds : Tuple[bool, ...]

Indicates whether the lower bound of each input dimension is implicit or explicit.

implicit_upper_bounds : Tuple[bool, ...]

Indicates whether the upper bound of each input dimension is implicit or explicit.

output : OutputIndexMaps

Output index maps.

to_json() Any

Returns the JSON representation of the transform.

origin : Tuple[int, ...]

Inclusive lower bound of the domain.

shape : Tuple[int, ...]

Shape of the domain.

size : int

Total number of elements in the domain.

Indexing

__call__(indices: Sequence[int]) Tuple[int, ...]

Maps an input index vector to an output index vector.

__getitem__(transform: IndexTransform) IndexTransform

Composes this index transform with another index transform.

__getitem__(domain: IndexDomain) IndexTransform

Slices this index transform by another domain.

__getitem__(expr: DimExpression) IndexTransform

Applies a dimension expression to this transform.

__getitem__(indices: NumpyIndexingSpec) IndexTransform

Applies a NumPy-style indexing operation with default index array semantics.

oindex[indices: NumpyIndexingSpec] IndexTransform

Applies a NumPy-style indexing operation with outer indexing semantics.

vindex[indices: NumpyIndexingSpec] IndexTransform

Applies a NumPy-style indexing operation with vectorized indexing semantics.

T : IndexTransform

View with transposed domain (reversed dimension order).

String representation

__repr__() str

Returns the string representation.