module onnxrt.ops_cpu.op_slice
#
Short summary#
module mlprodict.onnxrt.ops_cpu.op_slice
Runtime operator.
Classes#
class |
truncated documentation |
---|---|
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 ===== Produces a slice of the input tensor along multiple axes. Similar to numpy: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html … |
|
Functions#
function |
truncated documentation |
---|---|
Properties#
property |
truncated documentation |
---|---|
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of arguments as well as the list of parameters with the default values (close to the signature). … |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of modified parameters. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns the list of optional arguments. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
|
Returns all parameters in a dictionary. |
Methods#
method |
truncated documentation |
---|---|
|
|
|
Documentation#
Runtime operator.
- class mlprodict.onnxrt.ops_cpu.op_slice.SliceCommon(onnx_node, desc=None, **options)#
Bases:
OpRun
- __init__(onnx_node, desc=None, **options)#
- _run(data, starts, ends, axes=None, steps=None, attributes=None, verbose=0, fLOG=None)#
Should be overwritten.
- class mlprodict.onnxrt.ops_cpu.op_slice.Slice_1(onnx_node, desc=None, **options)#
Bases:
SliceCommon
- __init__(onnx_node, desc=None, **options)#
- _run(data, attributes=None, verbose=0, fLOG=None)#
Should be overwritten.
- class mlprodict.onnxrt.ops_cpu.op_slice.Slice_10(onnx_node, desc=None, **options)#
Bases:
SliceCommon
Slice#
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)#
- mlprodict.onnxrt.ops_cpu.op_slice._slice(data, starts, ends, axes=None, steps=None)#