Eine Frage haben? Verbinden Sie sich mit der Community im TensorFlow Forum

# tf.math.argmax

Returns the index with the largest value across axes of a tensor.

### Used in the notebooks

In case of identity returns the smallest index.

#### For example:

````A = tf.constant([2, 20, 30, 3, 6])`
`tf.math.argmax(A)  # A[2] is maximum in tensor A`
`<tf.Tensor: shape=(), dtype=int64, numpy=2>`
`B = tf.constant([[2, 20, 30, 3, 6], [3, 11, 16, 1, 8],`
`                 [14, 45, 23, 5, 27]])`
`tf.math.argmax(B, 0)`
`<tf.Tensor: shape=(5,), dtype=int64, numpy=array([2, 2, 0, 2, 2])>`
`tf.math.argmax(B, 1)`
`<tf.Tensor: shape=(3,), dtype=int64, numpy=array([2, 2, 1])>`
`C = tf.constant([0, 0, 0, 0])`
`tf.math.argmax(C) # Returns smallest index in case of ties`
`<tf.Tensor: shape=(), dtype=int64, numpy=0>`
```

`input` A `Tensor`.
`axis` An integer, the axis to reduce across. Default to 0.
`output_type` An optional output dtype (`tf.int32` or `tf.int64`). Defaults to `tf.int64`.
`name` An optional name for the operation.

A `Tensor` of type `output_type`.

[{ "type": "thumb-down", "id": "missingTheInformationINeed", "label":"Benötigte Informationen nicht gefunden" },{ "type": "thumb-down", "id": "tooComplicatedTooManySteps", "label":"Zu umständlich/zu viele Schritte" },{ "type": "thumb-down", "id": "outOfDate", "label":"Nicht mehr aktuell" },{ "type": "thumb-down", "id": "samplesCodeIssue", "label":"Samples / code issue" },{ "type": "thumb-down", "id": "otherDown", "label":"Sonstiges" }]
[{ "type": "thumb-up", "id": "easyToUnderstand", "label":"Leicht verständlich" },{ "type": "thumb-up", "id": "solvedMyProblem", "label":"Mein Problem wurde gelöst" },{ "type": "thumb-up", "id": "otherUp", "label":"Sonstiges" }]