diff --git a/tensorflow/python/util/tf_export.py b/tensorflow/python/util/tf_export.py index e4d6bebc3db..04c96d03617 100644 --- a/tensorflow/python/util/tf_export.py +++ b/tensorflow/python/util/tf_export.py @@ -341,9 +341,9 @@ class api_export(object): # pylint: disable=invalid-name # their own _tf_api_names as opposed to just inheriting it. if api_names_attr in func.__dict__: if not self._allow_multiple_exports: - # TODO(annarev): temporarily removing check to fix builds. - # Need to investigate why symbols get reported multiple times. - return + raise SymbolAlreadyExposedError( + 'Symbol %s is already exposed as %s.' % + (func.__name__, getattr(func, api_names_attr))) # pylint: disable=protected-access setattr(func, api_names_attr, names) def export_constant(self, module_name, name): diff --git a/tensorflow/python/util/tf_export_test.py b/tensorflow/python/util/tf_export_test.py index 51d9901fdb4..20625792e9b 100644 --- a/tensorflow/python/util/tf_export_test.py +++ b/tensorflow/python/util/tf_export_test.py @@ -152,8 +152,7 @@ class ValidateExportTest(test.TestCase): (('NAME_E', 'NAME_F'), 0.5)], module2._tf_api_constants) - # TODO(b/151745456): re-enable - def DISABLED_testRaisesExceptionIfAlreadyHasAPINames(self): + def testRaisesExceptionIfAlreadyHasAPINames(self): _test_function._tf_api_names = ['abc'] export_decorator = tf_export.tf_export('nameA', 'nameB') with self.assertRaises(tf_export.SymbolAlreadyExposedError):