【发布时间】:2021-01-09 01:32:19
【问题描述】:
张量是A_tensor,形状为[3,3,3],我想通过索引获取最后一个轴的值。
如何在 Tensorflow 中做到这一点?
A_tensor =tf.constant([[1,2,3],[2,3,4],[3,4,5]])
如何获取张量([[1,2],[2,3],[3,4]])?
【问题讨论】:
标签: tensorflow
张量是A_tensor,形状为[3,3,3],我想通过索引获取最后一个轴的值。
如何在 Tensorflow 中做到这一点?
A_tensor =tf.constant([[1,2,3],[2,3,4],[3,4,5]])
如何获取张量([[1,2],[2,3],[3,4]])?
【问题讨论】:
标签: tensorflow
你可以使用tf.gather():
A_tensor =tf.constant([[1,2,3],[2,3,4],[3,4,5]])
tf.gather(A_tensor,[[0,1]],axis=-1)
【讨论】: