module onnxrt.ops_cpu.op_gather#

Inheritance diagram of mlprodict.onnxrt.ops_cpu.op_gather

Short summary#

module mlprodict.onnxrt.ops_cpu.op_gather

Runtime operator.

source on GitHub

Classes#

class

truncated documentation

Gather

Gather ====== Given data tensor of rank r >= 1, and indices tensor of rank q, gather entries of the axis dimension …

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_modified

Returns the list of modified parameters.

args_mandatory

Returns the list of optional arguments.

args_optional

Returns the list of optional arguments.

atts_value

Returns all parameters in a dictionary.

Methods#

method

truncated documentation

__init__

_run

Documentation#

Runtime operator.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_gather.Gather(onnx_node, desc=None, **options)#

Bases: OpRun


Given data tensor of rank r >= 1, and indices tensor of rank q, gather entries of the axis dimension of data (by default outer-most one as axis=0) indexed by indices, and concatenates them in an output tensor of rank q + (r - 1).

axis = 0 :

Let k = indices[i_{0}, …, i_{q-1}] Then output[i_{0}, …, i_{q-1}, j_{0}, …, j_{r-2}] = input[k , j_{0}, …, j_{r-2}]

``
data = [

[1.0, 1.2], [2.3, 3.4], [4.5, 5.7],

] indices = [

[0, 1], [1, 2],

] output = [

[

[1.0, 1.2], [2.3, 3.4],

], [

[2.3, 3.4], [4.5, 5.7],

],

]

`` axis = 1 :

Let k = indices[i_{0}, …, i_{q-1}] Then output[j_{0}, i_{0}, …, i_{q-1}, j_{1}, …, j_{r-2}] = input[j_{0}, k, j_{1}, …, j_{r-2}]

``
data = [

[1.0, 1.2, 1.9], [2.3, 3.4, 3.9], [4.5, 5.7, 5.9],

] indices = [

[0, 2],

] axis = 1, output = [

[[1.0, 1.9]], [[2.3, 3.9]], [[4.5, 5.9]],

]

``

Attributes

  • axis: Which axis to gather on. Negative value means counting dimensions from the back. Accepted range is [-r, r-1] where r = rank(data). Default value is nameaxisi0typeINT (INT)

Inputs

  • data (heterogeneous)T: Tensor of rank r >= 1.

  • indices (heterogeneous)Tind: Tensor of int32/int64 indices, of any rank q. All index values are expected to be within bounds [-s, s-1] along axis of size s. It is an error if any of the index values are out of bounds.

Outputs

  • output (heterogeneous)T: Tensor of rank q + (r - 1).

Type Constraints

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

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

Version

Onnx name: Gather

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

Runtime implementation: Gather

__init__(onnx_node, desc=None, **options)#
_run(x, indices, attributes=None, verbose=0, fLOG=None)#

Should be overwritten.

source on GitHub