Skip to content

strided_slice

Classes

StridedSliceOperator

StridedSliceOperator(ident: int, op: OperatorT, model: ModelT, subgraph: SubGraphT, prefix: str = 'aot', attributes: dict[str, str] = {})

STRIDED_SLICE operator.

This operator performs a strided slice operation on the input tensor according to the specified parameters.

Parameters:

  • ident

    (int) –

    Operator identifier.

  • op

    (OperatorT) –

    Operator object from LiteRT model.

  • model

    (ModelT) –

    LiteRT model object.

  • subgraph

    (SubGraphT) –

    Subgraph object from LiteRT model.

  • prefix

    (str, default: 'aot' ) –

    Prefix for generated files. Defaults to "aot".

  • attributes

    (dict[str, str], default: {} ) –

    Attributes for template values. Defaults to {}.

Attributes

name property
name: str

Return the operator name.

input_indices property
input_indices: list[int]

Return the input tensor indices.

output_indices property
output_indices: list[int]

Return the output tensor indices.

input_tensors property
input_tensors: list[TensorT]

Return the input tensors.

output_tensors property
output_tensors: list[TensorT]

Return the output tensors.

Functions

compute_values
compute_values() -> dict[str, str]

Compute the values for the operator.

Returns:

  • dict[str, str]

    dict[str, str]: Computed values for the operator.

generate_source_code
generate_source_code(save_path: Path)

Generate the source code for the operator.

Parameters:

  • save_path
    (Path) –

    Path to save the generated code.

Functions

compute_start_for_dim

compute_start_for_dim(axis: int, axis_size: int, stride: int, begin_mask: int, start: int) -> int

Compute the start index for a given dimension.

Parameters:

  • axis

    (int) –

    The axis along which to compute the start.

  • axis_size

    (int) –

    The size of the axis.

  • stride

    (int) –

    The stride value.

  • begin_mask

    (int) –

    The begin mask.

  • start

    (int) –

    The initial start index.

Returns:

  • int ( int ) –

    The computed start index.

compute_end_for_dim

compute_end_for_dim(axis: int, axis_size: int, stride: int, end_mask: int, start: int, end: int, shrink_axis_mask: int, offset: bool) -> int

Compute the end index for a given dimension.

Parameters:

  • axis

    (int) –

    The axis along which to compute the end.

  • axis_size

    (int) –

    The size of the axis.

  • stride

    (int) –

    The stride value.

  • end_mask

    (int) –

    The end mask.

  • start

    (int) –

    The initial start index.

  • end

    (int) –

    The initial end index.

  • shrink_axis_mask

    (int) –

    The shrink axis mask.

  • offset

    (bool) –

    Whether to apply an offset to the end index.

Returns:

  • int ( int ) –

    The computed end index.