ArgMax - version 12#

This page documents version 12 of operator ArgMax. See ArgMax for the latest version (since version 13).

  • Domain: ai.onnx

  • Since version: 12

Computes the indices of the max elements of the input tensor’s element along the provided axis. The resulting tensor has the same rank as the input if keepdims equals 1. If keepdims equals 0, then the resulting tensor has the reduced dimension pruned. If select_last_index is True (default False), the index of the last occurrence of the max is selected if the max appears more than once in the input. Otherwise the index of the first occurrence is selected. The type of the output tensor is integer.

Inputs

  • data (T): An input tensor.

Outputs

  • reduced (tensor(int64)): Reduced output tensor with integer data type.

Attributes

  • axis (int): The axis in which to compute the arg indices. Accepted range is [-r, r-1] where r = rank(data).

  • keepdims (int): Keep the reduced dimension or not, default 1 means keep reduced dimension.

  • select_last_index (int): Whether to select the last index or the first index if the max appears in multiple indices, default is False (first index).

Type Constraints

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

Differences with previous version (11)#

SchemaDiff: ArgMax (domain 'ai.onnx')

  • old version: 11

  • new version: 12

  • breaking: no

Attributes:

  • added ‘select_last_index’: type=INT; required=False; default=0

Documentation:

  • line similarity: 0.60 (+2/-2 lines)

--- ArgMax v11
+++ ArgMax v12
@@ -1,5 +1,5 @@
 Computes the indices of the max elements of the input tensor's element along the provided axis.
 The resulting tensor has the same rank as the input if keepdims equals 1.
-If keepdims equal 0, then the resulting tensor has the reduced dimension pruned.
-The input tensor must not be empty.
+If keepdims equals 0, then the resulting tensor has the reduced dimension pruned.
+If select_last_index is True (default False), the index of the last occurrence of the max is selected if the max appears more than once in the input. Otherwise the index of the first occurrence is selected.
 The type of the output tensor is integer.