tensorstore.DimExpression.translate_backward_by[self, offsets: ]

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 = 10 + 1 * in
out = 20 + 1 * in
out = 0 + 1 * in
>>> 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 = 10 + 1 * in
out = 0 + 1 * in
out = 0 + 1 * in
>>> transform[ts.d['x', 'y'].translate_backward_by]
Rank 3 -> 3 index space transform:
Input domain:
0: [-8, -4) "x"
1: [-7, -2) "y"
2: [4, 10) "z"
Output index maps:
out = 10 + 1 * in
out = 10 + 1 * in
out = 0 + 1 * in
``````

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

Parameters:
offsets:

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.