def testCreateSquareAvgPool(self): height, width = 3, 3 with self.test_session(): images = tf.random_uniform((5, height, width, 3), seed=1) output = ops.avg_pool(images, 3) self.assertEquals(output.op.name, 'AvgPool/AvgPool') self.assertListEqual(output.get_shape().as_list(), [5, 1, 1, 3])
def testGlobalAvgPool(self): height, width = 3, 3 with self.test_session(): images = tf.random_uniform((5, height, width, 3), seed=1) output = ops.avg_pool(images, images.get_shape()[1:3], stride=1) self.assertListEqual(output.get_shape().as_list(), [5, 1, 1, 3])
def testCreateAvgPoolStrideSAME(self): height, width = 3, 3 with self.test_session(): images = tf.random_uniform((5, height, width, 3), seed=1) output = ops.avg_pool(images, [3, 3], stride=1, padding='SAME') self.assertListEqual(output.get_shape().as_list(), [5, height, width, 3])
def testCreateAvgPoolWithScope(self): height, width = 3, 3 with self.test_session(): images = tf.random_uniform((5, height, width, 3), seed=1) output = ops.avg_pool(images, [3, 3], scope='pool1') self.assertEquals(output.op.name, 'pool1/AvgPool')