module onnxrt.ops_cpu.op_slice#

Inheritance diagram of mlprodict.onnxrt.ops_cpu.op_slice

Short summary#

module mlprodict.onnxrt.ops_cpu.op_slice

Runtime operator.

source on GitHub

Classes#

class

truncated documentation

Slice_1

Slice_10

Slice ===== Produces a slice of the input tensor along multiple axes. Similar to numpy: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html

Slice_10

Slice ===== Produces a slice of the input tensor along multiple axes. Similar to numpy: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html

SliceCommon

Properties#

property

truncated documentation

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default

Returns the list of arguments as well as the list of parameters with the default values (close to the signature). …

args_default_modified

Returns the list of modified parameters.

args_default_modified

Returns the list of modified parameters.

args_default_modified

Returns the list of modified parameters.

args_default_modified

Returns the list of modified parameters.

args_mandatory

Returns the list of optional arguments.

args_mandatory

Returns the list of optional arguments.

args_mandatory

Returns the list of optional arguments.

args_mandatory

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

atts_value

Returns all parameters in a dictionary.

atts_value

Returns all parameters in a dictionary.

atts_value

Returns all parameters in a dictionary.

atts_value

Returns all parameters in a dictionary.

Methods#

method

truncated documentation

__init__

__init__

__init__

__init__

_infer_shapes

_infer_shapes

_infer_shapes

_infer_shapes

_infer_sizes

_infer_sizes

_infer_sizes

_infer_sizes

_infer_types

_infer_types

_infer_types

_infer_types

_run

_run

_run

_run

Documentation#

Runtime operator.

source on GitHub

mlprodict.onnxrt.ops_cpu.op_slice.Slice#

alias of Slice_10

class mlprodict.onnxrt.ops_cpu.op_slice.SliceCommon(onnx_node, desc=None, **options)#

Bases: OpRun

__init__(onnx_node, desc=None, **options)#
_infer_shapes(data, starts, ends, axes=None, steps=None)#

Should be overwritten.

source on GitHub

_infer_sizes(*args, **kwargs)#

Should be overwritten.

source on GitHub

_infer_types(data, starts, ends, axes=None, steps=None)#

Should be overwritten.

source on GitHub

_run(data, starts, ends, axes=None, steps=None, attributes=None, verbose=0, fLOG=None)#

Should be overwritten.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_slice.Slice_1(onnx_node, desc=None, **options)#

Bases: SliceCommon

__init__(onnx_node, desc=None, **options)#
_infer_shapes(data)#

Should be overwritten.

source on GitHub

_infer_types(data)#

Should be overwritten.

source on GitHub

_run(data, attributes=None, verbose=0, fLOG=None)#

Should be overwritten.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_slice.Slice_10(onnx_node, desc=None, **options)#

Bases: SliceCommon

Produces a slice of the input tensor along multiple axes. Similar to numpy: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html Slices uses starts, ends, axes and steps inputs to specify the start and end dimension and step for each axis in the list of axes, it uses this information to slice the input data tensor. If a negative value is passed for any of the start or end indices, it represent number of elements before the end of that dimension. If the value passed to start or end is larger than the n (the number of elements in this dimension), it represents n. For slicing to the end of a dimension with unknown size, it is recommended to pass in INT_MAX. If a negative value is passed for step, it represents slicing backward. If axes are omitted, they are set to [0, …, ndim-1]. If steps are omitted, they are set to [1, …, 1] of length len(starts) Example 1:

data = [

[1, 2, 3, 4], [5, 6, 7, 8],

] axes = [0, 1] starts = [1, 0] ends = [2, 3] steps = [1, 2] result = [

[5, 7],

]

Example 2:
data = [

[1, 2, 3, 4], [5, 6, 7, 8],

] starts = [0, 1] ends = [-1, 1000] result = [

[2, 3, 4],

]

Inputs

Between 3 and 5 inputs.

  • data (heterogeneous)T: Tensor of data to extract slices from.

  • starts (heterogeneous)Tind: 1-D tensor of starting indices of corresponding axis in axes

  • ends (heterogeneous)Tind: 1-D tensor of ending indices (exclusive) of corresponding axis in axes

  • axes (optional, heterogeneous)Tind: 1-D tensor of axes that starts and ends apply to.

  • steps (optional, heterogeneous)Tind: 1-D tensor of slice step of corresponding axis in axes. Default to 1.

Outputs

  • output (heterogeneous)T: Sliced data tensor.

Type Constraints

  • T tensor(uint8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(int8), tensor(int16), tensor(int32), tensor(int64), tensor(float16), tensor(float), tensor(double), tensor(string), tensor(bool), tensor(complex64), tensor(complex128): Constrain input and output types to all tensor types.

  • Tind tensor(int32), tensor(int64): Constrain indices to integer types

Version

Onnx name: Slice

This version of the operator has been available since version 10.

Runtime implementation: Slice

__init__(onnx_node, desc=None, **options)#