【发布时间】:2021-01-15 17:41:14
【问题描述】:
我想知道在给定 3D 张量时 argmax 是如何工作的。我知道当它有 2D 时会发生什么,但 3D 让我很困惑。
例子:
import tensorflow as tf
import numpy as np
sess = tf.Session()
coordinates = np.random.randint(0, 100, size=(3, 3, 2))
coordinates
Out[20]:
array([[[15, 23],
[ 3, 1],
[80, 56]],
[[98, 95],
[97, 82],
[10, 37]],
[[65, 32],
[25, 39],
[54, 68]]])
sess.run([tf.argmax(coordinates, axis=1)])
Out[21]:
[array([[2, 2],
[0, 0],
[0, 2]], dtype=int64)]
【问题讨论】:
标签: python numpy tensorflow argmax