TensorFlow學習筆記(3)tf.reduce_max,求最大值

weixin_33968104發表於2018-11-09

用例對應的原始碼,覺得有幫助可以Star

import tensorflow as tf
import numpy as np


#  Computes the maximum of elements across dimensions of a tensor. (deprecated arguments)
#
#  tf.reduce_max(
#      input_tensor,
#      axis=None,
#      keepdims=None,
#      name=None,
#      reduction_indices=None,
#      keep_dims=None
#      )

c = np.array([[3.,4], [5.,6], [6.,7]])

step = tf.reduce_max(c, 1)                                                                                  
with tf.Session() as sess:
    print(sess.run(step))

輸出

[4. 6. 7.]

相關文章