tensorstore.IndexTransform(domain: IndexDomain, output: Sequence[OutputIndexMap] | None = None)

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

Parameters:
domain: IndexDomain

The domain of the index transform.

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.

Examples

>>> domain = ts.IndexDomain(inclusive_min=[1, 2, 3],
...                         exclusive_max=[4, 5, 6])
>>> ts.IndexTransform(domain)
Rank 3 -> 3 index space transform:
  Input domain:
    0: [1, 4)
    1: [2, 5)
    2: [3, 6)
  Output index maps:
    out[0] = 0 + 1 * in[0]
    out[1] = 0 + 1 * in[1]
    out[2] = 0 + 1 * in[2]
>>> ts.IndexTransform(
...     domain,
...     output=[
...         ts.OutputIndexMap(offset=7),
...         ts.OutputIndexMap(input_dimension=0),
...     ],
... )
Rank 3 -> 2 index space transform:
  Input domain:
    0: [1, 4)
    1: [2, 5)
    2: [3, 6)
  Output index maps:
    out[0] = 7
    out[1] = 0 + 1 * in[0]