AirStridedSliceOptions
PythonOptions for STRIDEDSLICE operator.
AirStridedSliceOptions()Options for STRIDED_SLICE operator.
Provisional: importable, but outside the compatibility promise; a minor release can change or remove it.
begin
Pythonbegin: tuple[int, ...] = Field(..., description='Begin indices for each dimension')Begin indices for the specified leading axes.
end
Pythonend: tuple[int, ...] = Field(..., description='End indices for each dimension')End indices for the specified leading axes.
stride
Pythonstride: tuple[int, ...] = Field(..., description='Stride values for each dimension')Strides for the specified leading axes.
begin_mask
Pythonbegin_mask: int = Field(0, description='Mask for begin indices')Mask for begin indices (default 0).
end_mask
Pythonend_mask: int = Field(0, description='Mask for end indices')Mask for end indices (default 0).
ellipsis_mask
Pythonellipsis_mask: int = Field(0, description='Mask for ellipsis')Mask for ellipsis (default 0).
new_axis_mask
Pythonnew_axis_mask: int = Field(0, description='Mask for new axes')Mask for new axes (default 0).
shrink_axis_mask
Pythonshrink_axis_mask: int = Field(0, description='Mask for shrink axes')Mask for shrink axes (default 0).
offset
Pythonoffset: bool = Field(False, description='If True, apply offset to the begin and end indices')If True, apply offset to the begin and end indices (default False).
get_slices
PythonCompute each axis's slice, then pad to the kernel's padto dimensions.
get_slices(input_shape: tuple[int, ...], pad_to: int = 4) -> list[AirStrideSlice]Compute each axis’s slice, then pad to the kernel’s pad_to dimensions.
Missing trailing axes are taken whole, as in LiteRT. The parameter vectors must have equal lengths and cannot exceed the input rank.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
input_shape | tuple[int, ...] | Required | The shape of the input tensor. |
pad_to | int | 4 | The number of dimensions to pad the input shape to (default 4). |
Returns
| Type | Description |
|---|---|
list[AirStrideSlice] | A list of AirStrideSlice, each containing (begin, end, stride) for each axis. |
Raises
| Type | Description |
|---|---|
UnsupportedModelError | If ``ellipsis_mask`` or ``new_axis_mask`` is set. |
ConfigValueError | If the parameter vectors differ in length or exceed the input rank. |