Merge pull request #39525 from tensorflow/mm-fix-major-api-version
Fix tests when `tf._major_api_version` does not exist
This commit is contained in:
commit
3ffdb91f12
@ -74,7 +74,8 @@ class ModuleTest(test.TestCase):
|
|||||||
tf.summary.image
|
tf.summary.image
|
||||||
# If we use v2 API, check for create_file_writer,
|
# If we use v2 API, check for create_file_writer,
|
||||||
# otherwise check for FileWriter.
|
# otherwise check for FileWriter.
|
||||||
if hasattr(tf, '_major_api_version') and tf._major_api_version == 2:
|
if hasattr(tf, '_major_api_version'):
|
||||||
|
if tf._major_api_version == 2:
|
||||||
tf.summary.create_file_writer
|
tf.summary.create_file_writer
|
||||||
else:
|
else:
|
||||||
tf.summary.FileWriter
|
tf.summary.FileWriter
|
||||||
@ -82,6 +83,7 @@ class ModuleTest(test.TestCase):
|
|||||||
|
|
||||||
def testInternalKerasImport(self):
|
def testInternalKerasImport(self):
|
||||||
normalization_parent = layers.BatchNormalization.__module__.split('.')[-1]
|
normalization_parent = layers.BatchNormalization.__module__.split('.')[-1]
|
||||||
|
if hasattr(tf, '_major_api_version'):
|
||||||
if tf._major_api_version == 2:
|
if tf._major_api_version == 2:
|
||||||
self.assertEqual('normalization_v2', normalization_parent)
|
self.assertEqual('normalization_v2', normalization_parent)
|
||||||
self.assertTrue(layers.BatchNormalization._USE_V2_BEHAVIOR)
|
self.assertTrue(layers.BatchNormalization._USE_V2_BEHAVIOR)
|
||||||
|
Loading…
Reference in New Issue
Block a user