argmin

dragon.math.argmin(
  inputs,
  axis=None,
  keep_dims=False,
  **kwargs
)[source]

Compute the index of minimum elements along the given axis.

The argument axis could be negative or None:

x = dragon.constant([[1, 2, 3], [4, 5, 6]])

# A negative ``axis`` is the last-k axis
print(dragon.math.argmin(x, 1))
print(dragon.math.argmin(x, -1))  # Equivalent

# If ``axis`` is None, the vector-style reduction
# will be applied to return a scalar index
print(dragon.math.argmin(x))
Parameters:
  • inputs (dragon.Tensor) – The input tensor.
  • axis (int, optional) – The axis to reduce.
  • keep_dims (bool, optional, default=False) – Keep the reduced dimension or not.
Returns:

dragon.Tensor – The index of minimum elements.