def testCreateSquareMaxPool(self): height, width = 3, 3 with self.test_session(): images = tf.random_uniform((5, height, width, 3), seed=1) output = ops.max_pool(images, 3) self.assertEquals(output.op.name, 'MaxPool/MaxPool') self.assertListEqual(output.get_shape().as_list(), [5, 1, 1, 3])
def testGlobalMaxPool(self): height, width = 3, 3 with self.test_session(): images = tf.random_uniform((5, height, width, 3), seed=1) output = ops.max_pool(images, images.get_shape()[1:3], stride=1) self.assertListEqual(output.get_shape().as_list(), [5, 1, 1, 3])
def testCreateMaxPoolStrideSAME(self): height, width = 3, 3 with self.test_session(): images = tf.random_uniform((5, height, width, 3), seed=1) output = ops.max_pool(images, [3, 3], stride=1, padding='SAME') self.assertListEqual(output.get_shape().as_list(), [5, height, width, 3])
def testCreateMaxPoolWithScope(self): height, width = 3, 3 with self.test_session(): images = tf.random_uniform((5, height, width, 3), seed=1) output = ops.max_pool(images, [3, 3], scope='pool1') self.assertEquals(output.op.name, 'pool1/MaxPool')