argmax

dragon.vm.tensorflow.math.argmax(
  input,
  axis=None,
  name=None
)[source]

Compute the index of maximum elements along the given axis.

The argument axis could be negative or None:

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

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

# If ``axis`` is None, the vector-style reduction
# will be applied to return a scalar index
print(tf.math.argmax(x))
Parameters:
  • input (dragon.Tensor) – The input tensor.
  • axis (int, optional) – The axis to reduce.
  • name (str, optional) – The operation name.
Returns:

dragon.Tensor – The index of maximum elements.