argmax

dragon.math.argmax(
  inputs,
  axis=0,
  keepdims=False,
  **kwargs
)[source]

Compute the index of maximum elements along the given axis.

axis could be negative:

# A negative axis is the last-k axis
x = dragon.constant([[1, 2, 3], [4, 5, 6]])
print(dragon.math.argmax(x, axis=1))
print(dragon.math.argmax(x, axis=-1))  # Equivalent
Parameters:
  • inputs (dragon.Tensor) – The input tensor.
  • axis (int, optional, default=0) – The axis to reduce.
  • keepdims (bool, optional, default=False) – Keep the reduced dimension or not.
Returns:

dragon.Tensor – The index of maximum elements.