[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`)
This commit is contained in:
Deven Desai 2019-07-08 18:39:38 +00:00
parent 129500d0c7
commit f4094a3abf
6 changed files with 25 additions and 0 deletions

View File

@ -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

View File

@ -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),

View File

@ -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,

View File

@ -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"]:

View File

@ -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

View File

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