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" )
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)
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)