tensorflow相關函式___tf.reduce_max()
阿新 • • 發佈:2019-01-06
1、找出最大值
import tensorflow as tf
max_value = tf.reduce_max([1, 3, 2])
with tf.Session() as sess:
max_value = sess.run(max_value)
print(max_value)
輸出結果:
3
2、找出列上的最大值
import tensorflow as tf max_value = tf.reduce_max([[1, 3, 2],[4,5,6]],reduction_indices=[0]) with tf.Session() as sess: max_value = sess.run(max_value) print(max_value)
輸出結果:
[4 5 6]
3、找出行上的最大值
import tensorflow as tf
max_value = tf.reduce_max([[1, 3, 2],[4,5,6]],reduction_indices=[1])
with tf.Session() as sess:
max_value = sess.run(max_value)
print(max_value)
輸出結果:
[3 6]
注意:行是reduction_indices=[1] ;