diff --git a/tensorflow/python/kernel_tests/BUILD b/tensorflow/python/kernel_tests/BUILD index 6ea17b4fa5a..37d406e50d1 100644 --- a/tensorflow/python/kernel_tests/BUILD +++ b/tensorflow/python/kernel_tests/BUILD @@ -3405,7 +3405,6 @@ tf_py_test( data = ["//tensorflow/python/kernel_tests/testdata:self_adjoint_eig_op_test_files"], shard_count = 20, tags = [ - "no_rocm", # flaky test "no_windows", ], deps = [ diff --git a/tensorflow/python/kernel_tests/batch_matmul_op_test.py b/tensorflow/python/kernel_tests/batch_matmul_op_test.py index 55eca193d64..b68eaa123c5 100644 --- a/tensorflow/python/kernel_tests/batch_matmul_op_test.py +++ b/tensorflow/python/kernel_tests/batch_matmul_op_test.py @@ -262,10 +262,7 @@ class BatchMatMulBenchmark(test.Benchmark): if __name__ == "__main__": - dtypes_to_test = [np.float16, np.float32, np.float64, np.int32] - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - dtypes_to_test += [np.complex64, np.complex128] + dtypes_to_test = [np.float16, np.float32, np.float64, np.int32, np.complex64, np.complex128] for dtype_ in dtypes_to_test: for adjoint_a_ in False, True: for adjoint_b_ in False, True: diff --git a/tensorflow/python/kernel_tests/eig_op_test.py b/tensorflow/python/kernel_tests/eig_op_test.py index ffc61b7bcfe..74607c66dc2 100644 --- a/tensorflow/python/kernel_tests/eig_op_test.py +++ b/tensorflow/python/kernel_tests/eig_op_test.py @@ -183,10 +183,7 @@ def _GetEigTest(dtype_, shape_, compute_v_): if __name__ == "__main__": - dtypes_to_test = [dtypes_lib.float32, dtypes_lib.float64] - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - dtypes_to_test += [dtypes_lib.complex64, dtypes_lib.complex128] + dtypes_to_test = [dtypes_lib.float32, dtypes_lib.float64, dtypes_lib.complex64, dtypes_lib.complex128] for compute_v in True, False: for dtype in dtypes_to_test: for size in 1, 2, 5, 10: diff --git a/tensorflow/python/kernel_tests/init_ops_test.py b/tensorflow/python/kernel_tests/init_ops_test.py index 3822b4b89fc..4b9681afd2c 100644 --- a/tensorflow/python/kernel_tests/init_ops_test.py +++ b/tensorflow/python/kernel_tests/init_ops_test.py @@ -746,13 +746,6 @@ class ConvolutionDeltaOrthogonalInitializerTest(test.TestCase): else: shape = [4, 16, 16, 16, 64] convolution = convolutional.conv3d - - if test.is_built_with_rocm(): - # This subtest triggers a known bug in ROCm runtime code - # The bug has been fixed and will be available in ROCm 2.7 - # Re-enable this test once ROCm 2.7 is released - continue - inputs = random_ops.random_normal(shape, dtype=dtype) inputs_2norm = linalg_ops.norm(inputs) outputs = convolution( diff --git a/tensorflow/python/kernel_tests/linalg/linear_operator_adjoint_test.py b/tensorflow/python/kernel_tests/linalg/linear_operator_adjoint_test.py index c03203f02e5..409ab20985d 100644 --- a/tensorflow/python/kernel_tests/linalg/linear_operator_adjoint_test.py +++ b/tensorflow/python/kernel_tests/linalg/linear_operator_adjoint_test.py @@ -141,8 +141,6 @@ class LinearOperatorAdjointTest( full_matrix2, adjoint=True, adjoint_arg=True).to_dense())) def test_matmul_adjoint_complex_operator(self): - if test.is_built_with_rocm(): - self.skipTest("ROCm does not support BLAS operations for complex types") matrix1 = np.random.randn(4, 4) + 1j * np.random.randn(4, 4) matrix2 = np.random.randn(4, 4) + 1j * np.random.randn(4, 4) full_matrix1 = linalg.LinearOperatorFullMatrix(matrix1) @@ -201,7 +199,7 @@ class LinearOperatorAdjointTest( def test_solve_adjoint_complex_operator(self): if test.is_built_with_rocm(): - self.skipTest("ROCm does not support BLAS operations for complex types") + self.skipTest("ROCm does not support BLAS solve operations for complex types") matrix1 = self.evaluate(linear_operator_test_util.random_tril_matrix( [4, 4], dtype=dtypes.complex128, force_well_conditioned=True) + 1j * linear_operator_test_util.random_tril_matrix( diff --git a/tensorflow/python/kernel_tests/linalg/linear_operator_circulant_test.py b/tensorflow/python/kernel_tests/linalg/linear_operator_circulant_test.py index 810c47ba1e8..b3c8c2d20ff 100644 --- a/tensorflow/python/kernel_tests/linalg/linear_operator_circulant_test.py +++ b/tensorflow/python/kernel_tests/linalg/linear_operator_circulant_test.py @@ -357,11 +357,6 @@ class LinearOperatorCirculantTestNonHermitianSpectrum( self.evaluate(operator.assert_non_singular()) def test_assert_non_singular_does_not_fail_for_non_singular_operator(self): - - if test.is_built_with_rocm(): - # ROCm does not yet support BLAS operations with complex types. - self.skipTest("ROCm does not support BLAS operations for complex types") - spectrum = math_ops.cast([-3j, 4 + 0j, 2j + 2], dtypes.complex64) operator = linalg.LinearOperatorCirculant(spectrum) with self.cached_session(): @@ -665,11 +660,6 @@ class LinearOperatorCirculant3DTest(test.TestCase): yield sess def test_real_spectrum_gives_self_adjoint_operator(self): - - if test.is_built_with_rocm(): - # ROCm does not yet support BLAS operations with complext types - self.skipTest("ROCm does not support BLAS operations for complex types") - with self.cached_session(): # This is a real and hermitian spectrum. spectrum = linear_operator_test_util.random_normal( @@ -686,11 +676,6 @@ class LinearOperatorCirculant3DTest(test.TestCase): self.assertAllClose(matrix, matrix_h) def test_defining_operator_using_real_convolution_kernel(self): - - if test.is_built_with_rocm(): - # ROCm does not yet support BLAS operations with complext types - self.skipTest("ROCm does not support BLAS operations for complex types") - with self.cached_session(): convolution_kernel = linear_operator_test_util.random_normal( shape=(2, 2, 3, 5), dtype=dtypes.float32) @@ -709,11 +694,6 @@ class LinearOperatorCirculant3DTest(test.TestCase): np.testing.assert_allclose(0, np.imag(matrix), atol=1e-5) def test_defining_spd_operator_by_taking_real_part(self): - - if test.is_built_with_rocm(): - # ROCm does not yet support BLAS operations with complext types - self.skipTest("ROCm does not support BLAS operations for complex types") - with self.cached_session(): # Necessary for fft_kernel_label_map # S is real and positive. s = linear_operator_test_util.random_uniform( diff --git a/tensorflow/python/kernel_tests/lu_op_test.py b/tensorflow/python/kernel_tests/lu_op_test.py index 875a3768602..1c0280c3ce6 100644 --- a/tensorflow/python/kernel_tests/lu_op_test.py +++ b/tensorflow/python/kernel_tests/lu_op_test.py @@ -130,14 +130,12 @@ class LuOpTest(test.TestCase): for output_idx_type in (dtypes.int32, dtypes.int64): self._verifyLu(data.astype(dtype), output_idx_type=output_idx_type) - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - for dtype in (np.complex64, np.complex128): - for output_idx_type in (dtypes.int32, dtypes.int64): - complex_data = np.tril(1j * data, -1).astype(dtype) - complex_data += np.triu(-1j * data, 1).astype(dtype) - complex_data += data - self._verifyLu(complex_data, output_idx_type=output_idx_type) + for dtype in (np.complex64, np.complex128): + for output_idx_type in (dtypes.int32, dtypes.int64): + complex_data = np.tril(1j * data, -1).astype(dtype) + complex_data += np.triu(-1j * data, 1).astype(dtype) + complex_data += data + self._verifyLu(complex_data, output_idx_type=output_idx_type) def testPivoting(self): # This matrix triggers partial pivoting because the first diagonal entry @@ -152,17 +150,15 @@ class LuOpTest(test.TestCase): # Make sure p_val is not the identity permutation. self.assertNotAllClose(np.arange(3), p_val) - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - for dtype in (np.complex64, np.complex128): - complex_data = np.tril(1j * data, -1).astype(dtype) - complex_data += np.triu(-1j * data, 1).astype(dtype) - complex_data += data - self._verifyLu(complex_data) - _, p = linalg_ops.lu(data) - p_val = self.evaluate([p]) - # Make sure p_val is not the identity permutation. - self.assertNotAllClose(np.arange(3), p_val) + for dtype in (np.complex64, np.complex128): + complex_data = np.tril(1j * data, -1).astype(dtype) + complex_data += np.triu(-1j * data, 1).astype(dtype) + complex_data += data + self._verifyLu(complex_data) + _, p = linalg_ops.lu(data) + p_val = self.evaluate([p]) + # Make sure p_val is not the identity permutation. + self.assertNotAllClose(np.arange(3), p_val) def testInvalidMatrix(self): # LU factorization gives an error when the input is singular. @@ -195,13 +191,11 @@ class LuOpTest(test.TestCase): matrices = np.random.rand(batch_size, 5, 5) self._verifyLu(matrices) - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - # Generate random complex valued matrices. - np.random.seed(52) - matrices = np.random.rand(batch_size, 5, - 5) + 1j * np.random.rand(batch_size, 5, 5) - self._verifyLu(matrices) + # Generate random complex valued matrices. + np.random.seed(52) + matrices = np.random.rand(batch_size, 5, + 5) + 1j * np.random.rand(batch_size, 5, 5) + self._verifyLu(matrices) def testLargeMatrix(self): # Generate random matrices. @@ -210,12 +204,10 @@ class LuOpTest(test.TestCase): data = np.random.rand(n, n) self._verifyLu(data) - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - # Generate random complex valued matrices. - np.random.seed(129) - data = np.random.rand(n, n) + 1j * np.random.rand(n, n) - self._verifyLu(data) + # Generate random complex valued matrices. + np.random.seed(129) + data = np.random.rand(n, n) + 1j * np.random.rand(n, n) + self._verifyLu(data) @test_util.run_v1_only("b/120545219") def testEmpty(self): diff --git a/tensorflow/python/kernel_tests/matmul_op_test.py b/tensorflow/python/kernel_tests/matmul_op_test.py index 9f84946397e..dedfa58c3ed 100644 --- a/tensorflow/python/kernel_tests/matmul_op_test.py +++ b/tensorflow/python/kernel_tests/matmul_op_test.py @@ -226,10 +226,7 @@ class MatMulInfixOperatorTest(test_lib.TestCase): if __name__ == "__main__": sizes = [1, 3, 5] trans_options = [[False, False], [True, False], [False, True]] - dtypes_to_test = [np.int32, np.int64, np.float16, np.float32, np.float64] - if not test_lib.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - dtypes_to_test += [np.complex64, np.complex128] + dtypes_to_test = [np.int32, np.int64, np.float16, np.float32, np.float64, np.complex64, np.complex128] # TF2 does not support placeholders under eager so we skip it for use_static_shape in set([True, tf2.enabled()]): for dtype in dtypes_to_test: diff --git a/tensorflow/python/kernel_tests/matrix_exponential_op_test.py b/tensorflow/python/kernel_tests/matrix_exponential_op_test.py index ed47e8980d9..007db5d2076 100644 --- a/tensorflow/python/kernel_tests/matrix_exponential_op_test.py +++ b/tensorflow/python/kernel_tests/matrix_exponential_op_test.py @@ -91,8 +91,6 @@ class ExponentialOpTest(test.TestCase): @test_util.run_deprecated_v1 def testNonsymmetricComplex(self): - if test.is_built_with_rocm(): - self.skipTest("ROCm does not support BLAS operations for complex types") matrix1 = np.array([[1., 2.], [3., 4.]]) matrix2 = np.array([[1., 3.], [3., 5.]]) matrix1 = matrix1.astype(np.complex64) @@ -114,8 +112,6 @@ class ExponentialOpTest(test.TestCase): self._verifyExponentialReal(self._makeBatch(matrix1, matrix2)) def testSymmetricPositiveDefiniteComplex(self): - if test.is_built_with_rocm(): - self.skipTest("ROCm does not support BLAS operations for complex types") matrix1 = np.array([[2., 1.], [1., 2.]]) matrix2 = np.array([[3., -1.], [-1., 3.]]) matrix1 = matrix1.astype(np.complex64) diff --git a/tensorflow/python/kernel_tests/matrix_inverse_op_test.py b/tensorflow/python/kernel_tests/matrix_inverse_op_test.py index 56a242c0234..244e95eefa2 100644 --- a/tensorflow/python/kernel_tests/matrix_inverse_op_test.py +++ b/tensorflow/python/kernel_tests/matrix_inverse_op_test.py @@ -74,17 +74,14 @@ class InverseOpTest(test.TestCase): self._verifyInverseReal(matrix2) # A multidimensional batch of 2x2 matrices self._verifyInverseReal(self._makeBatch(matrix1, matrix2)) - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - # Complex - matrix1 = matrix1.astype(np.complex64) - matrix1 += 1j * matrix1 - matrix2 = matrix2.astype(np.complex64) - matrix2 += 1j * matrix2 - self._verifyInverseComplex(matrix1) - self._verifyInverseComplex(matrix2) - # Complex batch - self._verifyInverseComplex(self._makeBatch(matrix1, matrix2)) + matrix1 = matrix1.astype(np.complex64) + matrix1 += 1j * matrix1 + matrix2 = matrix2.astype(np.complex64) + matrix2 += 1j * matrix2 + self._verifyInverseComplex(matrix1) + self._verifyInverseComplex(matrix2) + # Complex batch + self._verifyInverseComplex(self._makeBatch(matrix1, matrix2)) def testSymmetricPositiveDefinite(self): # 2x2 matrices @@ -94,17 +91,14 @@ class InverseOpTest(test.TestCase): self._verifyInverseReal(matrix2) # A multidimensional batch of 2x2 matrices self._verifyInverseReal(self._makeBatch(matrix1, matrix2)) - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - # Complex - matrix1 = matrix1.astype(np.complex64) - matrix1 += 1j * matrix1 - matrix2 = matrix2.astype(np.complex64) - matrix2 += 1j * matrix2 - self._verifyInverseComplex(matrix1) - self._verifyInverseComplex(matrix2) - # Complex batch - self._verifyInverseComplex(self._makeBatch(matrix1, matrix2)) + matrix1 = matrix1.astype(np.complex64) + matrix1 += 1j * matrix1 + matrix2 = matrix2.astype(np.complex64) + matrix2 += 1j * matrix2 + self._verifyInverseComplex(matrix1) + self._verifyInverseComplex(matrix2) + # Complex batch + self._verifyInverseComplex(self._makeBatch(matrix1, matrix2)) @test_util.deprecated_graph_mode_only def testNonSquareMatrix(self): diff --git a/tensorflow/python/kernel_tests/matrix_logarithm_op_test.py b/tensorflow/python/kernel_tests/matrix_logarithm_op_test.py index 0f5da8b27a4..6d9ba6b66c0 100644 --- a/tensorflow/python/kernel_tests/matrix_logarithm_op_test.py +++ b/tensorflow/python/kernel_tests/matrix_logarithm_op_test.py @@ -59,8 +59,6 @@ class LogarithmOpTest(test.TestCase): @test_util.run_v1_only("b/120545219") def testNonsymmetric(self): - if test.is_built_with_rocm(): - self.skipTest("ROCm does not support BLAS operations for complex types") # 2x2 matrices matrix1 = np.array([[1., 2.], [3., 4.]]) matrix2 = np.array([[1., 3.], [3., 5.]]) @@ -75,8 +73,6 @@ class LogarithmOpTest(test.TestCase): @test_util.run_v1_only("b/120545219") def testSymmetricPositiveDefinite(self): - if test.is_built_with_rocm(): - self.skipTest("ROCm does not support BLAS operations for complex types") # 2x2 matrices matrix1 = np.array([[2., 1.], [1., 2.]]) matrix2 = np.array([[3., -1.], [-1., 3.]]) @@ -111,8 +107,6 @@ class LogarithmOpTest(test.TestCase): @test_util.run_v1_only("b/120545219") def testRandomSmallAndLargeComplex64(self): - if test.is_built_with_rocm(): - self.skipTest("ROCm does not support BLAS operations for complex types") np.random.seed(42) for batch_dims in [(), (1,), (3,), (2, 2)]: for size in 8, 31, 32: @@ -124,8 +118,6 @@ class LogarithmOpTest(test.TestCase): @test_util.run_v1_only("b/120545219") def testRandomSmallAndLargeComplex128(self): - if test.is_built_with_rocm(): - self.skipTest("ROCm does not support BLAS operations for complex types") np.random.seed(42) for batch_dims in [(), (1,), (3,), (2, 2)]: for size in 8, 31, 32: diff --git a/tensorflow/python/kernel_tests/matrix_square_root_op_test.py b/tensorflow/python/kernel_tests/matrix_square_root_op_test.py index 2a761140b0a..c36d83e2530 100644 --- a/tensorflow/python/kernel_tests/matrix_square_root_op_test.py +++ b/tensorflow/python/kernel_tests/matrix_square_root_op_test.py @@ -59,16 +59,13 @@ class SquareRootOpTest(test.TestCase): self._verifySquareRootReal(matrix1) self._verifySquareRootReal(matrix2) self._verifySquareRootReal(self._makeBatch(matrix1, matrix2)) - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - # Complex - matrix1 = matrix1.astype(np.complex64) - matrix2 = matrix2.astype(np.complex64) - matrix1 += 1j * matrix1 - matrix2 += 1j * matrix2 - self._verifySquareRootComplex(matrix1) - self._verifySquareRootComplex(matrix2) - self._verifySquareRootComplex(self._makeBatch(matrix1, matrix2)) + matrix1 = matrix1.astype(np.complex64) + matrix2 = matrix2.astype(np.complex64) + matrix1 += 1j * matrix1 + matrix2 += 1j * matrix2 + self._verifySquareRootComplex(matrix1) + self._verifySquareRootComplex(matrix2) + self._verifySquareRootComplex(self._makeBatch(matrix1, matrix2)) def testSymmetricPositiveDefinite(self): matrix1 = np.array([[2., 1.], [1., 2.]]) diff --git a/tensorflow/python/kernel_tests/self_adjoint_eig_op_test.py b/tensorflow/python/kernel_tests/self_adjoint_eig_op_test.py index 0ada446e84b..ef64f7cf61b 100644 --- a/tensorflow/python/kernel_tests/self_adjoint_eig_op_test.py +++ b/tensorflow/python/kernel_tests/self_adjoint_eig_op_test.py @@ -240,10 +240,7 @@ def _GetSelfAdjointEigGradTest(dtype_, shape_, compute_v_): if __name__ == "__main__": - dtypes_to_test = [dtypes_lib.float32, dtypes_lib.float64] - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - dtypes_to_test += [dtypes_lib.complex64, dtypes_lib.complex128] + dtypes_to_test = [dtypes_lib.float32, dtypes_lib.float64, dtypes_lib.complex64, dtypes_lib.complex128] for compute_v in True, False: for dtype in dtypes_to_test: for size in 1, 2, 5, 10: diff --git a/tensorflow/python/kernel_tests/signal/BUILD b/tensorflow/python/kernel_tests/signal/BUILD index 230b35ccf02..08e65d1fb7c 100644 --- a/tensorflow/python/kernel_tests/signal/BUILD +++ b/tensorflow/python/kernel_tests/signal/BUILD @@ -123,7 +123,6 @@ cuda_py_tests( srcs = ["spectral_ops_test.py"], python_version = "PY3", tags = [ - "no_rocm", "nomac", ], deps = [ diff --git a/tensorflow/python/kernel_tests/svd_op_test.py b/tensorflow/python/kernel_tests/svd_op_test.py index bbcab12a163..9da9f3d6717 100644 --- a/tensorflow/python/kernel_tests/svd_op_test.py +++ b/tensorflow/python/kernel_tests/svd_op_test.py @@ -370,10 +370,7 @@ class SVDBenchmark(test.Benchmark): if __name__ == "__main__": - dtypes_to_test = [np.float32, np.float64] - if not test.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - dtypes_to_test += [np.complex64, np.complex128] + dtypes_to_test = [np.float32, np.float64, np.complex64, np.complex128] for compute_uv in False, True: for full_matrices in False, True: for dtype in dtypes_to_test: @@ -392,7 +389,7 @@ if __name__ == "__main__": for compute_uv in False, True: for full_matrices in False, True: dtypes = ([np.float32, np.float64] + [np.complex64, np.complex128] * - (not compute_uv) * (not test.is_built_with_rocm())) + (not compute_uv)) for dtype in dtypes: mat_shapes = [(10, 11), (11, 10), (11, 11), (2, 2, 2, 3)] if not full_matrices or not compute_uv: diff --git a/tensorflow/python/kernel_tests/tensordot_op_test.py b/tensorflow/python/kernel_tests/tensordot_op_test.py index 635a76323f6..3663a91281b 100644 --- a/tensorflow/python/kernel_tests/tensordot_op_test.py +++ b/tensorflow/python/kernel_tests/tensordot_op_test.py @@ -221,10 +221,7 @@ def _get_tensordot_tests(dtype_, rank_a_, rank_b_, num_dims_, dynamic_shape_): if __name__ == "__main__": - dtypes_to_test = [np.float16, np.float32, np.float64] - if not test_lib.is_built_with_rocm(): - # ROCm does not support BLAS operations for complex types - dtypes_to_test += [np.complex64, np.complex128] + dtypes_to_test = [np.float16, np.float32, np.float64, np.complex64, np.complex128] for dtype in dtypes_to_test: for rank_a in 1, 2, 4, 5: for rank_b in 1, 2, 4, 5: diff --git a/tensorflow/python/ops/special_math_ops_test.py b/tensorflow/python/ops/special_math_ops_test.py index 77136adc5b4..ae77db4653e 100644 --- a/tensorflow/python/ops/special_math_ops_test.py +++ b/tensorflow/python/ops/special_math_ops_test.py @@ -338,13 +338,7 @@ class EinsumTest(test.TestCase): self._check('ab...,b->ab...', (2, 3, 1, 1, 5), (3,)) def test_dtypes(self): - dtypes = [] - if test.is_built_with_rocm(): - # This test triggers the BLAS op calls on the GPU - # ROCm does not support BLAS operations for complex types - dtypes = [np.float64, np.float32] - else: - dtypes = [np.float64, np.float32, np.complex64, np.complex128] + dtypes = [np.float64, np.float32, np.complex64, np.complex128] for dtype in dtypes: self._check('ij,jk->ik', (2, 2), (2, 2), dtype=dtype) self._check('ji,jk->ik', (2, 2), (2, 2), dtype=dtype)