池化函数-avg_pool

import tensorflow as tf
import numpy as np


input_data = tf.Variable( np.random.rand(10, 6, 6 ,3), dtype = np.float32 )
filter_data = tf.Variable( np.random.rand(2, 2, 3, 10), dtype = np.float32)
y = tf.nn.conv2d(input_data, filter_data, strides = [1, 1, 1, 1], padding = 'SAME')
output = tf.nn.avg_pool(value = y, ksize = [1, 2, 2, 1], strides = [1, 1, 1, 1], padding = 'SAME')

with tf.Session() as sess:
    sess.run(tf.global_variables_initializer())
    print sess.run(output)
    print sess.run(tf.shape(output))


 

 

你可能感兴趣的:(TFBoy)