【发布时间】:2021-10-18 20:14:08
【问题描述】:
如何找到每个元素中的最大值以便得到 2、4、6、8?
import tensorflow as tf
a = tf.constant([
[[1, 2]], [[3, 4]],
[[5, 6]], [[7, 8]]])
我尝试了以下代码:
tf.reduce_max(a, keepdims=True)
但这只是给我 8 作为输出,而忽略其余部分。
【问题讨论】:
-
reduce_max有一个axis参数,也许可以试试。
标签: python tensorflow tensorflow2.0