From f4094a3abffdca011e9e9087a6b15e01e36febdd Mon Sep 17 00:00:00 2001 From: Deven Desai Date: Mon, 8 Jul 2019 18:39:38 +0000 Subject: [PATCH] [ROCm] Skipping subtests that check support for Pooling Ops with 3D tensors ROCm platform currently does not support Pooling Ops with 3D Tensors This commit skips subtests (within python unit-tests) that test this functionality. The "skip" is guarded by the call to "is_built_with_rocm()", and hence these unit-tests will not be affected in any way when running with TF which was not built with ROCm support (i.e. `--config=rocm`) --- tensorflow/python/eager/backprop_test.py | 2 ++ tensorflow/python/keras/backend_test.py | 2 ++ tensorflow/python/keras/layers/pooling_test.py | 4 ++++ tensorflow/python/kernel_tests/pool_test.py | 7 +++++++ tensorflow/python/ops/nn_test.py | 8 ++++++++ .../python/ops/parallel_for/control_flow_ops_test.py | 2 ++ 6 files changed, 25 insertions(+) diff --git a/tensorflow/python/eager/backprop_test.py b/tensorflow/python/eager/backprop_test.py index 3bebc8341ca..479ae52a7d8 100644 --- a/tensorflow/python/eager/backprop_test.py +++ b/tensorflow/python/eager/backprop_test.py @@ -1334,6 +1334,8 @@ class BackpropTest(test.TestCase): @test_util.run_in_graph_and_eager_modes def testMaxPooling3DGradient(self): + if test.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") def forward(a): r = max_pooling3d(a, pool_size=pool_size, strides=strides, padding='SAME') return r diff --git a/tensorflow/python/keras/backend_test.py b/tensorflow/python/keras/backend_test.py index e3bc5467261..82965b4b0de 100644 --- a/tensorflow/python/keras/backend_test.py +++ b/tensorflow/python/keras/backend_test.py @@ -789,6 +789,8 @@ class BackendNNOpsTest(test.TestCase, parameterized.TestCase): y = keras.backend.pool2d(x, (2, 2), strides=(2, 2), pool_mode='other') def test_pool3d(self): + if test.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") val = np.random.random((10, 3, 10, 10, 10)) x = keras.backend.variable(val) y = keras.backend.pool3d(x, (2, 2, 2), strides=(1, 1, 1), diff --git a/tensorflow/python/keras/layers/pooling_test.py b/tensorflow/python/keras/layers/pooling_test.py index 67df4d7a256..13d08d953fd 100644 --- a/tensorflow/python/keras/layers/pooling_test.py +++ b/tensorflow/python/keras/layers/pooling_test.py @@ -144,6 +144,8 @@ class Pooling3DTest(test.TestCase): @tf_test_util.run_in_graph_and_eager_modes def test_maxpooling_3d(self): + if test.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") pool_size = (3, 3, 3) testing_utils.layer_test( keras.layers.MaxPooling3D, @@ -163,6 +165,8 @@ class Pooling3DTest(test.TestCase): @tf_test_util.run_in_graph_and_eager_modes def test_averagepooling_3d(self): + if test.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") pool_size = (3, 3, 3) testing_utils.layer_test( keras.layers.AveragePooling3D, diff --git a/tensorflow/python/kernel_tests/pool_test.py b/tensorflow/python/kernel_tests/pool_test.py index 78e786f01ca..0f0eaa25402 100644 --- a/tensorflow/python/kernel_tests/pool_test.py +++ b/tensorflow/python/kernel_tests/pool_test.py @@ -219,6 +219,8 @@ class PoolingTest(test.TestCase): strides=strides) def testPool3D(self): + if test.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") with self.session(use_gpu=test.is_gpu_available()): for padding in ["SAME", "VALID"]: for pooling_type in ["MAX", "AVG"]: @@ -274,6 +276,9 @@ class PoolingTest(test.TestCase): strides=[1, 2], dilation_rate=[1, 1], data_format="NCHW") + if test.is_built_with_rocm(): + # Pooling with 3D tensors is not supported in ROCm + continue self._test( input_shape=[2, 2, 7, 5, 3], window_shape=[2, 2, 2], @@ -358,6 +363,8 @@ class PoolingTest(test.TestCase): @test_util.run_deprecated_v1 def testGradient3D(self): + if test.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") with self.session(use_gpu=test.is_gpu_available()): for padding in ["SAME", "VALID"]: for pooling_type in ["AVG", "MAX"]: diff --git a/tensorflow/python/ops/nn_test.py b/tensorflow/python/ops/nn_test.py index df07721e5d3..e8236547c97 100644 --- a/tensorflow/python/ops/nn_test.py +++ b/tensorflow/python/ops/nn_test.py @@ -1291,6 +1291,8 @@ class AvgPoolTest(test_lib.TestCase): self.assertAllEqual(self.evaluate(y1), self.evaluate(y2)) def test3DTensor(self): + if test_lib.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") x = array_ops.ones([3, 7, 6, 6, 5]) ksize = 2 strides = 2 @@ -1301,6 +1303,8 @@ class AvgPoolTest(test_lib.TestCase): self.assertAllEqual(self.evaluate(y1), self.evaluate(y2)) def test3DNumpy(self): + if test_lib.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") x = np.ones([3, 7, 6, 6, 5], dtype=np.float32) ksize = 2 strides = 2 @@ -1355,6 +1359,8 @@ class MaxPoolTest(test_lib.TestCase): self.assertAllEqual(self.evaluate(y1), self.evaluate(y2)) def test3DTensor(self): + if test_lib.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") x = array_ops.ones([3, 7, 6, 6, 5]) ksize = 2 strides = 2 @@ -1365,6 +1371,8 @@ class MaxPoolTest(test_lib.TestCase): self.assertAllEqual(self.evaluate(y1), self.evaluate(y2)) def test3DNumpy(self): + if test_lib.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") x = np.ones([3, 7, 6, 6, 5], dtype=np.float32) ksize = 2 strides = 2 diff --git a/tensorflow/python/ops/parallel_for/control_flow_ops_test.py b/tensorflow/python/ops/parallel_for/control_flow_ops_test.py index f795b7c7a2f..ac45a89473f 100644 --- a/tensorflow/python/ops/parallel_for/control_flow_ops_test.py +++ b/tensorflow/python/ops/parallel_for/control_flow_ops_test.py @@ -354,6 +354,8 @@ class NNTest(PForTestCase): self._test_loop_fn(loop_fn, 3, loop_fn_dtypes=[dtypes.float32] * 3) def test_max_pool3d(self): + if test.is_built_with_rocm(): + self.skipTest("Pooling with 3D tensors is not supported in ROCm") with backprop.GradientTape(persistent=True) as g: x = random_ops.random_uniform([3, 3, 2, 12, 12, 3]) g.watch(x)