def reduce_mean(input_tensor,axis=None, keepdims=None )学习

import tensorflow as tf

A = tf.Variable(
    [[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]], [[17, 18, 19, 20], [21, 22, 23, 24]]])
B = tf.reduce_mean(input_tensor=A, axis=0, keepdims=True)

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    print(A.get_shape())
    print(B.get_shape())
    print(B.eval())
# (3, 2, 4)
# (1, 2, 4)
# [[[ 9 10 11 12]
#   [13 14 15 16]]]

猜你喜欢

转载自blog.csdn.net/xky1306102chenhong/article/details/81145753
def