- 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 otherIndexable
types.See also
IndexDomain
, which represents the domain of an index transform.The
JSON representation
.
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.
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).
- translate_to[origins] IndexTransform
Returns a new view with
origin
translated to the specified origin.
- translate_by[offsets] IndexTransform
Returns a new view with the
origin
translated by the specified offsets.
- translate_backward_by[offsets] IndexTransform
Returns a new view with the
origin
translated backward by the specified offsets.
- label[labels: str | Sequence[str]] IndexTransform
Returns a new view with the dimension labels changed.
- mark_bounds_implicit[implicit] IndexTransform
Returns a new view with the lower/upper bounds changed to implicit/explicit.
-
transpose(axes: DimSelectionLike | None =
None
) IndexTransform Returns a view with a transposed domain.
String representation¶