tensorstore.DimExpression.translate_backward_by[self, offsets: Sequence[int | None] | int | None] DimExpression

Translates (shifts) the domains of the selected input dimensions backward by the specified offsets, without affecting the output range.

Examples

>>> transform = ts.IndexTransform(input_inclusive_min=[2, 3, 4],
...                               input_shape=[4, 5, 6],
...                               input_labels=['x', 'y', 'z'])
>>> transform[ts.d['x', 'y'].translate_backward_by[10, 20]]
Rank 3 -> 3 index space transform:
  Input domain:
    0: [-8, -4) "x"
    1: [-17, -12) "y"
    2: [4, 10) "z"
  Output index maps:
    out[0] = 10 + 1 * in[0]
    out[1] = 20 + 1 * in[1]
    out[2] = 0 + 1 * in[2]
>>> transform[ts.d['x', 'y'].translate_backward_by[10, None]]
Rank 3 -> 3 index space transform:
  Input domain:
    0: [-8, -4) "x"
    1: [3, 8) "y"
    2: [4, 10) "z"
  Output index maps:
    out[0] = 10 + 1 * in[0]
    out[1] = 0 + 1 * in[1]
    out[2] = 0 + 1 * in[2]
>>> transform[ts.d['x', 'y'].translate_backward_by[10]]
Rank 3 -> 3 index space transform:
  Input domain:
    0: [-8, -4) "x"
    1: [-7, -2) "y"
    2: [4, 10) "z"
  Output index maps:
    out[0] = 10 + 1 * in[0]
    out[1] = 10 + 1 * in[1]
    out[2] = 0 + 1 * in[2]

The new dimension selection is the same as the prior dimension selection.

Parameters:
offsets: Sequence[int | None] | int | None

The offsets for each of the selected dimensions. May also be a scalar, e.g. 5, in which case the same offset is used for all selected dimensions. Specifying None for a given dimension (equivalent to specifying an offset of 0) leaves the origin of that dimension unchanged.

Returns:

Dimension expression with the translation operation added.

Raises:

IndexError – If the number origins does not match the number of selected dimensions.