예제 #1
0
 def testInvalidDataFormat(self):
     height, width = 7, 9
     images = tf.random.uniform((5, height, width, 3), seed=1)
     with self.assertRaisesRegex(ValueError, "data_format"):
         pooling_layers.max_pooling2d(
             images, 3, strides=2, data_format="invalid"
         )
예제 #2
0
    def testInvalidPoolSize(self):
        height, width = 7, 9
        images = tf.random.uniform((5, height, width, 3), seed=1)
        with self.assertRaisesRegex(ValueError, "pool_size"):
            pooling_layers.max_pooling2d(images, (1, 2, 3), strides=2)

        with self.assertRaisesRegex(ValueError, "pool_size"):
            pooling_layers.max_pooling2d(images, None, strides=2)
예제 #3
0
    def testInvalidStrides(self):
        height, width = 7, 9
        images = tf.random.uniform((5, height, width, 3), seed=1)
        with self.assertRaisesRegex(ValueError, "strides"):
            pooling_layers.max_pooling2d(images, 3, strides=(1, 2, 3))

        with self.assertRaisesRegex(ValueError, "strides"):
            pooling_layers.max_pooling2d(images, 3, strides=None)