提交 5550cb0c 编写于 作者: S Scott Zhu 提交者: TensorFlower Gardener

Fix remaining broken tests in v1.

PiperOrigin-RevId: 395526123
上级 519430bb
......@@ -46,6 +46,12 @@ class PreprocessingAppliedInDatasetCreatorTest(tf.test.TestCase):
"""Demonstrate Keras preprocessing layers applied in tf.data.Dataset.map."""
def testDistributedModelFit(self, strategy):
if (not tf.__internal__.tf2.enabled()
and isinstance(strategy,
tf.distribute.experimental.ParameterServerStrategy)):
self.skipTest(
"Parameter Server strategy with dataset creator need to be run when "
"eager execution is enabled.")
with strategy.scope():
preprocessing_model = utils.make_preprocessing_model(self.get_temp_dir())
training_model = utils.make_training_model()
......
......@@ -47,6 +47,12 @@ class PreprocessingAppliedInModelTest(tf.test.TestCase):
"""Demonstrate Keras preprocessing layers applied inside a Model."""
def testDistributedModelFit(self, strategy):
if (not tf.__internal__.tf2.enabled()
and isinstance(strategy,
tf.distribute.experimental.ParameterServerStrategy)):
self.skipTest(
"Parameter Server strategy with dataset creator need to be run when "
"eager execution is enabled.")
with strategy.scope():
preprocessing_model = utils.make_preprocessing_model(self.get_temp_dir())
training_model = utils.make_training_model()
......
......@@ -183,7 +183,12 @@ class LayerUtilsTest(tf.test.TestCase):
reader = open(fpath, 'r')
lines = reader.readlines()
reader.close()
self.assertEqual(len(lines), 39)
# The output content are slightly different for the input shapes between
# v1 and v2.
if tf.__internal__.tf2.enabled():
self.assertEqual(len(lines), 39)
else:
self.assertEqual(len(lines), 40)
except ImportError:
pass
......
......@@ -232,6 +232,8 @@ class TestIsExtensionType(tf.test.TestCase):
class TestRandomSeedSetting(tf.test.TestCase):
def test_seeds(self):
if not tf.__internal__.tf2.enabled():
self.skipTest('set_random_seed() is only expected to work in tf2.')
def get_model_output():
model = keras.Sequential([
keras.layers.Dense(10),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册