.. _op_ai_onnx_Max: Max === - **Domain**: ``ai.onnx`` - **Since version**: 13 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 `the doc `_. **Inputs** - **data_0** (*T*): List of tensors for max. **Outputs** - **max** (*T*): Output tensor. **Type Constraints** - **T**: Constrain input and output types to numeric tensors. Allowed types: tensor(bfloat16), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8). Examples -------- **test_cc_max_bcast** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(2, 2), dtype=float32 [[1., 2.], [3., 4.]] data_1: shape=(), dtype=float32 2.5 Outputs: result: shape=(2, 2), dtype=float32 [[2.5, 2.5], [3. , 4. ]] **test_cc_shape_inference_resize_tile** .. code-block:: text Node: Max(tile_out, zeros_scalar) -> (output) .. code-block:: text Inputs: tile_out: shape=(10, 6), dtype=float32 [[ 1., 2., 3., 4., 5., 6.], [ 7., 8., 9., 10., 11., 12.], [13., 14., 15., 16., 17., 18.], [19., 20., 21., 22., 23., 24.], [25., 26., 27., 28., 29., 30.], [31., 32., 33., 34., 35., 36.], [37., 38., 39., 40., 41., 42.], [43., 44., 45., 46., 47., 48.], [49., 50., 51., 52., 53., 54.], [55., 56., 57., 58., 59., 60.]] Outputs: output: shape=(10, 6), dtype=float32 [[ 1., 3., 5., 1., 3., 5.], [13., 15., 17., 13., 15., 17.], [25., 27., 29., 25., 27., 29.], [37., 39., 41., 37., 39., 41.], [49., 51., 53., 49., 51., 53.], [ 1., 3., 5., 1., 3., 5.], [13., 15., 17., 13., 15., 17.], [25., 27., 29., 25., 27., 29.], [37., 39., 41., 37., 39., 41.], [49., 51., 53., 49., 51., 53.]] **test_max_example** .. code-block:: text Node: Max(data_0, data_1, data_2) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=float32 [3., 2., 1.] data_1: shape=(3,), dtype=float32 [1., 4., 4.] data_2: shape=(3,), dtype=float32 [2., 5., 3.] Outputs: result: shape=(3,), dtype=float32 [3., 5., 4.] **test_max_float16** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=float16 [1., 4., 3.] data_1: shape=(3,), dtype=float16 [3., 2., 5.] Outputs: result: shape=(3,), dtype=float16 [3., 4., 5.] **test_max_float32** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=float32 [3., 2., 1.] data_1: shape=(3,), dtype=float32 [1., 4., 4.] Outputs: result: shape=(3,), dtype=float32 [3., 4., 4.] **test_max_float64** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=float64 [3., 2., 1.] data_1: shape=(3,), dtype=float64 [1., 4., 4.] Outputs: result: shape=(3,), dtype=float64 [3., 4., 4.] **test_max_int16** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=int16 [3, 2, 1] data_1: shape=(3,), dtype=int16 [1, 4, 4] Outputs: result: shape=(3,), dtype=int16 [3, 4, 4] **test_max_int32** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=int32 [3, 2, 1] data_1: shape=(3,), dtype=int32 [1, 4, 4] Outputs: result: shape=(3,), dtype=int32 [3, 4, 4] **test_max_int64** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=int64 [3, 2, 1] data_1: shape=(3,), dtype=int64 [1, 4, 4] Outputs: result: shape=(3,), dtype=int64 [3, 4, 4] **test_max_int8** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=int8 [3, 2, 1] data_1: shape=(3,), dtype=int8 [1, 4, 4] Outputs: result: shape=(3,), dtype=int8 [3, 4, 4] **test_max_one_input** .. code-block:: text Node: Max(data_0) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=float32 [3., 2., 1.] Outputs: result: shape=(3,), dtype=float32 [3., 2., 1.] **test_max_two_inputs** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=float32 [3., 2., 1.] data_1: shape=(3,), dtype=float32 [1., 4., 4.] Outputs: result: shape=(3,), dtype=float32 [3., 4., 4.] **test_max_uint16** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=uint16 [3, 2, 1] data_1: shape=(3,), dtype=uint16 [1, 4, 4] Outputs: result: shape=(3,), dtype=uint16 [3, 4, 4] **test_max_uint32** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=uint32 [3, 2, 1] data_1: shape=(3,), dtype=uint32 [1, 4, 4] Outputs: result: shape=(3,), dtype=uint32 [3, 4, 4] **test_max_uint64** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=uint64 [3, 2, 1] data_1: shape=(3,), dtype=uint64 [1, 4, 4] Outputs: result: shape=(3,), dtype=uint64 [3, 4, 4] **test_max_uint8** .. code-block:: text Node: Max(data_0, data_1) -> (result) .. code-block:: text Inputs: data_0: shape=(3,), dtype=uint8 [3, 2, 1] data_1: shape=(3,), dtype=uint8 [1, 4, 4] Outputs: result: shape=(3,), dtype=uint8 [3, 4, 4] Differences with previous version (12) -------------------------------------- **SchemaDiff**: ``Max`` (domain ``'ai.onnx'``) * old version: 12 * new version: 13 * breaking: no **Type constraints:** * changed 'T': added types: ['tensor(bfloat16)'] Version History --------------- - :doc:`Version 12 ` - :doc:`Version 8 ` - :doc:`Version 6 ` - :doc:`Version 1 `