net = tf.reduce_mean(net, [1, 2], name='pool5', keep_dims=True)
利用 tf.reduce_mean(net,[1,2]) 来实现。
具体请参见slim models zoo. https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/slim/python/slim/nets/resnet_v1.py.
注意slim models zoo里的tf.reduce_mean已经替换成 net = math_ops.reduce_mean(net, [1, 2], name='pool5', keep_dims=True)。
网友评论