-
tensorstore.IndexTransform(input_rank: int | None =
None
, *, input_inclusive_min: Sequence[int] | None =None
, implicit_lower_bounds: Sequence[bool] | None =None
, input_exclusive_max: Sequence[int] | None =None
, input_inclusive_max: Sequence[int] | None =None
, input_shape: Sequence[int] | None =None
, implicit_upper_bounds: Sequence[bool] | None =None
, input_labels: Sequence[str | None] | None =None
, output: Sequence[OutputIndexMap] | None =None
) Constructs an index transform from component vectors.
- Parameters:¶
- input_rank: int | None =
None
¶ Number of input dimensions. Only required if the input rank is not otherwise specified.
- input_inclusive_min: Sequence[int] | None =
None
¶ Inclusive lower bounds for each input dimension. If not specified, defaults to all zero if
input_shape
is specified, otherwise unbounded.- implicit_lower_bounds: Sequence[bool] | None =
None
¶ Indicates whether each lower bound is implicit or explicit. Defaults to all explicit if
input_inclusive_min
orinput_shape
is specified, otherwise defaults to all implicit.- input_exclusive_max: Sequence[int] | None =
None
¶ Exclusive upper bounds for each input dimension. At most one of
input_exclusive_max
,input_inclusive_max
, andinput_shape
may be specified.- input_inclusive_max: Sequence[int] | None =
None
¶ Inclusive upper bounds for each input dimension.
- input_shape: Sequence[int] | None =
None
¶ Size for each input dimension.
- implicit_upper_bounds: Sequence[bool] | None =
None
¶ Indicates whether each upper bound is implicit or explicit. Defaults to all explicit if
input_exclusive_max
,input_inclusive_max
, orshape
is specified, otherwise defaults to all implicit.- input_labels: Sequence[str | None] | None =
None
¶ Dimension labels for each input dimension. Defaults to all unlabeled.
- output: Sequence[OutputIndexMap] | None =
None
¶ Sequence of output index maps, or
OutputIndexMaps
object from an existing transform. If not specified, constructs an identity transform over the domain.
- input_rank: int | None =
Examples
>>> # Identity transform of rank 3 >>> ts.IndexTransform(3) Rank 3 -> 3 index space transform: Input domain: 0: (-inf*, +inf*) 1: (-inf*, +inf*) 2: (-inf*, +inf*) Output index maps: out[0] = 0 + 1 * in[0] out[1] = 0 + 1 * in[1] out[2] = 0 + 1 * in[2] >>> ts.IndexTransform( ... input_shape=[3, 2], ... output=[ ... ts.OutputIndexMap(offset=7, input_dimension=1), ... ts.OutputIndexMap([[1, 2]], offset=2, stride=-1), ... ts.OutputIndexMap(8), ... ts.OutputIndexMap([[1, 2]], ... offset=2, ... stride=-1, ... index_range=ts.Dim(inclusive_min=0, ... exclusive_max=8)), ... ], ... ) Rank 2 -> 4 index space transform: Input domain: 0: [0, 3) 1: [0, 2) Output index maps: out[0] = 7 + 1 * in[1] out[1] = 2 + -1 * bounded((-inf, +inf), array(in)), where array = {{1, 2}} out[2] = 8 out[3] = 2 + -1 * bounded([0, 8), array(in)), where array = {{1, 2}}