module onnxrt.ops_cpu.op_einsum#

Inheritance diagram of mlprodict.onnxrt.ops_cpu.op_einsum

Short summary#

module mlprodict.onnxrt.ops_cpu.op_einsum

Runtime operator.

source on GitHub

Classes#

class

truncated documentation

Einsum

Einsum ====== An einsum of the form term1, term2 -> output-term produces an output tensor using the following equation …

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

to_python

Documentation#

Runtime operator.

source on GitHub

class mlprodict.onnxrt.ops_cpu.op_einsum.Einsum(onnx_node, desc=None, **options)#

Bases: OpRun


An einsum of the form term1, term2 -> output-term produces an output tensor using the following equation

output[output-term] = reduce-sum( input1[term1] * input2[term] )

where the reduce-sum performs a summation over all the indices occurring in the input terms (term1, term2) that do not occur in the output-term.

The Einsum operator evaluates algebraic tensor operations on a sequence of tensors, using the Einstein summation convention. The equation string contains a comma-separated sequence of lower case letters. Each term corresponds to an operand tensor, and the characters within the terms correspond to operands dimensions.

This sequence may be followed by “->” to separate the left and right hand side of the equation. If the equation contains “->” followed by the right-hand side, the explicit (not classical) form of the Einstein summation is performed, and the right-hand side indices indicate output tensor dimensions. In other cases, output indices are (implicitly) set to the alphabetically sorted sequence of indices appearing exactly once in the equation.

When a dimension character is repeated in the left-hand side, it represents summation along the dimension.

The equation may contain ellipsis (”…”) to enable broadcasting. Ellipsis must indicate a fixed number of dimensions. Specifically, every occurrence of ellipsis in the equation must represent the same number of dimensions. The right-hand side may contain exactly one ellipsis. In implicit mode, the ellipsis dimensions are set to the beginning of the output. The equation string may contain space (U+0020) character.

Attributes

  • equation (required): Einsum expression string. default value cannot be automatically retrieved (STRING)

Inputs

Between 1 and 2147483647 inputs.

  • Inputs (variadic, heterogeneous)T: Operands

Outputs

  • Output (heterogeneous)T: Output 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): Constrain input and output types to all numerical tensor types.

Version

Onnx name: Einsum

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

Runtime implementation: Einsum

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

Should be overwritten.

source on GitHub

to_python(inputs)#

Returns a python code equivalent to this operator.

Parameters:

inputs – inputs name

Returns:

imports, python code, both as strings

source on GitHub