[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:
parent
129500d0c7
commit
f4094a3abf
@ -1334,6 +1334,8 @@ class BackpropTest(test.TestCase):
|
|||||||
@test_util.run_in_graph_and_eager_modes
|
@test_util.run_in_graph_and_eager_modes
|
||||||
def testMaxPooling3DGradient(self):
|
def testMaxPooling3DGradient(self):
|
||||||
|
|
||||||
|
if test.is_built_with_rocm():
|
||||||
|
self.skipTest("Pooling with 3D tensors is not supported in ROCm")
|
||||||
def forward(a):
|
def forward(a):
|
||||||
r = max_pooling3d(a, pool_size=pool_size, strides=strides, padding='SAME')
|
r = max_pooling3d(a, pool_size=pool_size, strides=strides, padding='SAME')
|
||||||
return r
|
return r
|
||||||
|
@ -789,6 +789,8 @@ class BackendNNOpsTest(test.TestCase, parameterized.TestCase):
|
|||||||
y = keras.backend.pool2d(x, (2, 2), strides=(2, 2), pool_mode='other')
|
y = keras.backend.pool2d(x, (2, 2), strides=(2, 2), pool_mode='other')
|
||||||
|
|
||||||
def test_pool3d(self):
|
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))
|
val = np.random.random((10, 3, 10, 10, 10))
|
||||||
x = keras.backend.variable(val)
|
x = keras.backend.variable(val)
|
||||||
y = keras.backend.pool3d(x, (2, 2, 2), strides=(1, 1, 1),
|
y = keras.backend.pool3d(x, (2, 2, 2), strides=(1, 1, 1),
|
||||||
|
@ -144,6 +144,8 @@ class Pooling3DTest(test.TestCase):
|
|||||||
|
|
||||||
@tf_test_util.run_in_graph_and_eager_modes
|
@tf_test_util.run_in_graph_and_eager_modes
|
||||||
def test_maxpooling_3d(self):
|
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)
|
pool_size = (3, 3, 3)
|
||||||
testing_utils.layer_test(
|
testing_utils.layer_test(
|
||||||
keras.layers.MaxPooling3D,
|
keras.layers.MaxPooling3D,
|
||||||
@ -163,6 +165,8 @@ class Pooling3DTest(test.TestCase):
|
|||||||
|
|
||||||
@tf_test_util.run_in_graph_and_eager_modes
|
@tf_test_util.run_in_graph_and_eager_modes
|
||||||
def test_averagepooling_3d(self):
|
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)
|
pool_size = (3, 3, 3)
|
||||||
testing_utils.layer_test(
|
testing_utils.layer_test(
|
||||||
keras.layers.AveragePooling3D,
|
keras.layers.AveragePooling3D,
|
||||||
|
@ -219,6 +219,8 @@ class PoolingTest(test.TestCase):
|
|||||||
strides=strides)
|
strides=strides)
|
||||||
|
|
||||||
def testPool3D(self):
|
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()):
|
with self.session(use_gpu=test.is_gpu_available()):
|
||||||
for padding in ["SAME", "VALID"]:
|
for padding in ["SAME", "VALID"]:
|
||||||
for pooling_type in ["MAX", "AVG"]:
|
for pooling_type in ["MAX", "AVG"]:
|
||||||
@ -274,6 +276,9 @@ class PoolingTest(test.TestCase):
|
|||||||
strides=[1, 2],
|
strides=[1, 2],
|
||||||
dilation_rate=[1, 1],
|
dilation_rate=[1, 1],
|
||||||
data_format="NCHW")
|
data_format="NCHW")
|
||||||
|
if test.is_built_with_rocm():
|
||||||
|
# Pooling with 3D tensors is not supported in ROCm
|
||||||
|
continue
|
||||||
self._test(
|
self._test(
|
||||||
input_shape=[2, 2, 7, 5, 3],
|
input_shape=[2, 2, 7, 5, 3],
|
||||||
window_shape=[2, 2, 2],
|
window_shape=[2, 2, 2],
|
||||||
@ -358,6 +363,8 @@ class PoolingTest(test.TestCase):
|
|||||||
|
|
||||||
@test_util.run_deprecated_v1
|
@test_util.run_deprecated_v1
|
||||||
def testGradient3D(self):
|
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()):
|
with self.session(use_gpu=test.is_gpu_available()):
|
||||||
for padding in ["SAME", "VALID"]:
|
for padding in ["SAME", "VALID"]:
|
||||||
for pooling_type in ["AVG", "MAX"]:
|
for pooling_type in ["AVG", "MAX"]:
|
||||||
|
@ -1291,6 +1291,8 @@ class AvgPoolTest(test_lib.TestCase):
|
|||||||
self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
|
self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
|
||||||
|
|
||||||
def test3DTensor(self):
|
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])
|
x = array_ops.ones([3, 7, 6, 6, 5])
|
||||||
ksize = 2
|
ksize = 2
|
||||||
strides = 2
|
strides = 2
|
||||||
@ -1301,6 +1303,8 @@ class AvgPoolTest(test_lib.TestCase):
|
|||||||
self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
|
self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
|
||||||
|
|
||||||
def test3DNumpy(self):
|
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)
|
x = np.ones([3, 7, 6, 6, 5], dtype=np.float32)
|
||||||
ksize = 2
|
ksize = 2
|
||||||
strides = 2
|
strides = 2
|
||||||
@ -1355,6 +1359,8 @@ class MaxPoolTest(test_lib.TestCase):
|
|||||||
self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
|
self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
|
||||||
|
|
||||||
def test3DTensor(self):
|
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])
|
x = array_ops.ones([3, 7, 6, 6, 5])
|
||||||
ksize = 2
|
ksize = 2
|
||||||
strides = 2
|
strides = 2
|
||||||
@ -1365,6 +1371,8 @@ class MaxPoolTest(test_lib.TestCase):
|
|||||||
self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
|
self.assertAllEqual(self.evaluate(y1), self.evaluate(y2))
|
||||||
|
|
||||||
def test3DNumpy(self):
|
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)
|
x = np.ones([3, 7, 6, 6, 5], dtype=np.float32)
|
||||||
ksize = 2
|
ksize = 2
|
||||||
strides = 2
|
strides = 2
|
||||||
|
@ -354,6 +354,8 @@ class NNTest(PForTestCase):
|
|||||||
self._test_loop_fn(loop_fn, 3, loop_fn_dtypes=[dtypes.float32] * 3)
|
self._test_loop_fn(loop_fn, 3, loop_fn_dtypes=[dtypes.float32] * 3)
|
||||||
|
|
||||||
def test_max_pool3d(self):
|
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:
|
with backprop.GradientTape(persistent=True) as g:
|
||||||
x = random_ops.random_uniform([3, 3, 2, 12, 12, 3])
|
x = random_ops.random_uniform([3, 3, 2, 12, 12, 3])
|
||||||
g.watch(x)
|
g.watch(x)
|
||||||
|
Loading…
Reference in New Issue
Block a user