Sum¶
Sum - 13¶
Version¶
name: Sum (GitHub)
domain:
mainsince_version:
13function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 13.
Summary¶
Element-wise sum of each of the input tensors (with Numpy-style broadcasting support). All inputs and outputs must have the same data type. This operator supports multidirectional (i.e., Numpy-style) broadcasting; for more details please check Broadcasting in ONNX.
Inputs¶
Between 1 and 2147483647 inputs.
data_0 (variadic, heterogeneous) - T:
List of tensors for sum.
Outputs¶
sum (heterogeneous) - T:
Output tensor.
Type Constraints¶
T in (
tensor(bfloat16),tensor(double),tensor(float),tensor(float16)):Constrain input and output types to float tensors.
Examples¶
default¶
import numpy as np
import onnx
data_0 = np.array([3, 0, 2]).astype(np.float32)
data_1 = np.array([1, 3, 4]).astype(np.float32)
data_2 = np.array([2, 6, 6]).astype(np.float32)
result = np.array([6, 9, 12]).astype(np.float32)
node = onnx.helper.make_node(
"Sum",
inputs=["data_0", "data_1", "data_2"],
outputs=["result"],
)
expect(
node,
inputs=[data_0, data_1, data_2],
outputs=[result],
name="test_sum_example",
)
node = onnx.helper.make_node(
"Sum",
inputs=["data_0"],
outputs=["result"],
)
expect(node, inputs=[data_0], outputs=[data_0], name="test_sum_one_input")
result = np.add(data_0, data_1)
node = onnx.helper.make_node(
"Sum",
inputs=["data_0", "data_1"],
outputs=["result"],
)
expect(
node, inputs=[data_0, data_1], outputs=[result], name="test_sum_two_inputs"
)
Sum - 8¶
Version¶
name: Sum (GitHub)
domain:
mainsince_version:
8function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 8.
Summary¶
Element-wise sum of each of the input tensors (with Numpy-style broadcasting support). All inputs and outputs must have the same data type. This operator supports multidirectional (i.e., Numpy-style) broadcasting; for more details please check Broadcasting in ONNX.
Inputs¶
Between 1 and 2147483647 inputs.
data_0 (variadic, heterogeneous) - T:
List of tensors for sum.
Outputs¶
sum (heterogeneous) - T:
Output tensor.
Type Constraints¶
T in (
tensor(double),tensor(float),tensor(float16)):Constrain input and output types to float tensors.
Sum - 6¶
Version¶
name: Sum (GitHub)
domain:
mainsince_version:
6function:
Falsesupport_level:
SupportType.COMMONshape inference:
True
This version of the operator has been available since version 6.
Summary¶
Element-wise sum of each of the input tensors. All inputs and outputs must have the same shape and data type.
Inputs¶
Between 1 and 2147483647 inputs.
data_0 (variadic, heterogeneous) - T:
List of tensors for Sum.
Outputs¶
sum (heterogeneous) - T:
Output tensor. Same dimension as inputs.
Type Constraints¶
T in (
tensor(double),tensor(float),tensor(float16)):Constrain input and output types to float tensors.
Sum - 1¶
Version¶
name: Sum (GitHub)
domain:
mainsince_version:
1function:
Falsesupport_level:
SupportType.COMMONshape inference:
False
This version of the operator has been available since version 1.
Summary¶
Element-wise sum of each of the input tensors. All inputs and outputs must have the same shape and data type.
Attributes¶
consumed_inputs - INTS :
legacy optimization attribute.
Inputs¶
Between 1 and 2147483647 inputs.
data_0 (variadic, heterogeneous) - T:
List of tensors for Sum.
Outputs¶
sum (heterogeneous) - T:
Output tensor. Same dimension as inputs.
Type Constraints¶
T in (
tensor(double),tensor(float),tensor(float16)):Constrain input and output types to float tensors.