Max#

Max - 13#

Version

  • name: Max (GitHub)

  • domain: main

  • since_version: 13

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

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

Summary

Element-wise max 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 max.

Outputs

  • max (heterogeneous) - T: Output tensor.

Type Constraints

  • T in ( tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain input and output types to numeric tensors.

Examples

default

data_0 = np.array([3, 2, 1]).astype(np.float32)
data_1 = np.array([1, 4, 4]).astype(np.float32)
data_2 = np.array([2, 5, 3]).astype(np.float32)
result = np.array([3, 5, 4]).astype(np.float32)
node = onnx.helper.make_node(
    "Max",
    inputs=["data_0", "data_1", "data_2"],
    outputs=["result"],
)
expect(
    node,
    inputs=[data_0, data_1, data_2],
    outputs=[result],
    name="test_max_example",
)

node = onnx.helper.make_node(
    "Max",
    inputs=["data_0"],
    outputs=["result"],
)
expect(node, inputs=[data_0], outputs=[data_0], name="test_max_one_input")

result = np.maximum(data_0, data_1)
node = onnx.helper.make_node(
    "Max",
    inputs=["data_0", "data_1"],
    outputs=["result"],
)
expect(
    node, inputs=[data_0, data_1], outputs=[result], name="test_max_two_inputs"
)

_max_all_numeric_types

for op_dtype in all_numeric_dtypes:
    data_0 = np.array([3, 2, 1]).astype(op_dtype)
    data_1 = np.array([1, 4, 4]).astype(op_dtype)
    result = np.array([3, 4, 4]).astype(op_dtype)
    node = onnx.helper.make_node(
        "Max",
        inputs=["data_0", "data_1"],
        outputs=["result"],
    )
    expect(
        node,
        inputs=[data_0, data_1],
        outputs=[result],
        name=f"test_max_{np.dtype(op_dtype).name}",
    )

Differences

00Element-wise max of each of the input tensors (with Numpy-style broadcasting support).Element-wise max of each of the input tensors (with Numpy-style broadcasting support).
11All inputs and outputs must have the same data type.All inputs and outputs must have the same data type.
22This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check Broadcasting in ONNX _.This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check Broadcasting in ONNX _.
33
44**Inputs****Inputs**
55
66Between 1 and 2147483647 inputs.Between 1 and 2147483647 inputs.
77
88* **data_0** (variadic, heterogeneous) - **T**:* **data_0** (variadic, heterogeneous) - **T**:
99 List of tensors for max. List of tensors for max.
1010
1111**Outputs****Outputs**
1212
1313* **max** (heterogeneous) - **T**:* **max** (heterogeneous) - **T**:
1414 Output tensor. Output tensor.
1515
1616**Type Constraints****Type Constraints**
1717
1818* **T** in (* **T** in (
19 tensor(bfloat16),
1920 tensor(double), tensor(double),
2021 tensor(float), tensor(float),
2122 tensor(float16), tensor(float16),
2223 tensor(int16), tensor(int16),
2324 tensor(int32), tensor(int32),
2425 tensor(int64), tensor(int64),
2526 tensor(int8), tensor(int8),
2627 tensor(uint16), tensor(uint16),
2728 tensor(uint32), tensor(uint32),
2829 tensor(uint64), tensor(uint64),
2930 tensor(uint8) tensor(uint8)
3031 ): ):
3132 Constrain input and output types to numeric tensors. Constrain input and output types to numeric tensors.

Max - 12#

Version

  • name: Max (GitHub)

  • domain: main

  • since_version: 12

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

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

Summary

Element-wise max 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 max.

Outputs

  • max (heterogeneous) - T: Output tensor.

Type Constraints

  • T in ( tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ): Constrain input and output types to numeric tensors.

Differences

00Element-wise max of each of the input tensors (with Numpy-style broadcasting support).Element-wise max of each of the input tensors (with Numpy-style broadcasting support).
11All inputs and outputs must have the same data type.All inputs and outputs must have the same data type.
22This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check Broadcasting in ONNX _.This operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check Broadcasting in ONNX _.
33
44**Inputs****Inputs**
55
66Between 1 and 2147483647 inputs.Between 1 and 2147483647 inputs.
77
88* **data_0** (variadic, heterogeneous) - **T**:* **data_0** (variadic, heterogeneous) - **T**:
99 List of tensors for max. List of tensors for max.
1010
1111**Outputs****Outputs**
1212
1313* **max** (heterogeneous) - **T**:* **max** (heterogeneous) - **T**:
1414 Output tensor. Output tensor.
1515
1616**Type Constraints****Type Constraints**
1717
1818* **T** in (* **T** in (
1919 tensor(double), tensor(double),
2020 tensor(float), tensor(float),
2121 tensor(float16) tensor(float16),
22 tensor(int16),
23 tensor(int32),
24 tensor(int64),
25 tensor(int8),
26 tensor(uint16),
27 tensor(uint32),
28 tensor(uint64),
29 tensor(uint8)
2230 ): ):
2331 Constrain input and output types to float tensors. Constrain input and output types to numeric tensors.

Max - 8#

Version

  • name: Max (GitHub)

  • domain: main

  • since_version: 8

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

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

Summary

Element-wise max 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 max.

Outputs

  • max (heterogeneous) - T: Output tensor.

Type Constraints

  • T in ( tensor(double), tensor(float), tensor(float16) ): Constrain input and output types to float tensors.

Differences

0Element-wise max of each of the input tensors (with Numpy-style broadcasting support).
1All inputs and outputs must have the same data type.
02Element-wise max of each of the input tensors. All inputs and outputs mustThis operator supports **multidirectional (i.e., Numpy-style) broadcasting**; for more details please check Broadcasting in ONNX <https://github.com/onnx/onnx/blob/master/docs/Broadcasting.md>_.
1have the same shape and data type.
23
34**Inputs****Inputs**
45
56Between 1 and 2147483647 inputs.Between 1 and 2147483647 inputs.
67
78* **data_0** (variadic, heterogeneous) - **T**:* **data_0** (variadic, heterogeneous) - **T**:
89 List of tensors for Max. List of tensors for max.
910
1011**Outputs****Outputs**
1112
1213* **max** (heterogeneous) - **T**:* **max** (heterogeneous) - **T**:
1314 Output tensor. Same dimension as inputs. Output tensor.
1415
1516**Type Constraints****Type Constraints**
1617
1718* **T** in (* **T** in (
1819 tensor(double), tensor(double),
1920 tensor(float), tensor(float),
2021 tensor(float16) tensor(float16)
2122 ): ):
2223 Constrain input and output types to float tensors. Constrain input and output types to float tensors.

Max - 6#

Version

  • name: Max (GitHub)

  • domain: main

  • since_version: 6

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: True

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

Summary

Element-wise max 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 Max.

Outputs

  • max (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.

Differences

00Element-wise max of each of the input tensors. All inputs and outputs mustElement-wise max of each of the input tensors. All inputs and outputs must
11have the same shape and data type.have the same shape and data type.
22
3**Attributes**
4
5* **consumed_inputs**:
6 legacy optimization attribute.
7
83**Inputs****Inputs**
94
105Between 1 and 2147483647 inputs.Between 1 and 2147483647 inputs.
116
127* **data_0** (variadic, heterogeneous) - **T**:* **data_0** (variadic, heterogeneous) - **T**:
138 List of tensors for Max. List of tensors for Max.
149
1510**Outputs****Outputs**
1611
1712* **max** (heterogeneous) - **T**:* **max** (heterogeneous) - **T**:
1813 Output tensor. Same dimension as inputs. Output tensor. Same dimension as inputs.
1914
2015**Type Constraints****Type Constraints**
2116
2217* **T** in (* **T** in (
2318 tensor(double), tensor(double),
2419 tensor(float), tensor(float),
2520 tensor(float16) tensor(float16)
2621 ): ):
2722 Constrain input and output types to float tensors. Constrain input and output types to float tensors.

Max - 1#

Version

  • name: Max (GitHub)

  • domain: main

  • since_version: 1

  • function: False

  • support_level: SupportType.COMMON

  • shape inference: False

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

Summary

Element-wise max of each of the input tensors. All inputs and outputs must have the same shape and data type.

Attributes

  • consumed_inputs: legacy optimization attribute.

Inputs

Between 1 and 2147483647 inputs.

  • data_0 (variadic, heterogeneous) - T: List of tensors for Max.

Outputs

  • max (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.