From 576daec845cbc83cebb040e018ba9fdae1902738 Mon Sep 17 00:00:00 2001 From: Francois Chollet Date: Sun, 14 Jul 2024 22:27:14 -0700 Subject: [PATCH] Fix CI --- keras/src/backend/tensorflow/optimizer_distribute_test.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/keras/src/backend/tensorflow/optimizer_distribute_test.py b/keras/src/backend/tensorflow/optimizer_distribute_test.py index 80f2ccf845c..d93d3f0e153 100644 --- a/keras/src/backend/tensorflow/optimizer_distribute_test.py +++ b/keras/src/backend/tensorflow/optimizer_distribute_test.py @@ -43,9 +43,12 @@ def test_config(self): @parameterized.parameters([("keras_sgd",), ("tf_keras_sgd",)]) def test_single_step(self, optimizer_type): if optimizer_type == "tf_keras_sgd": - import tf_keras + try: + import tf_keras - optimizer_fn = tf_keras.optimizers.SGD + optimizer_fn = tf_keras.optimizers.SGD + except (ImportError, AttributeError): + self.skipTest("tf_keras not installed") else: optimizer_fn = SGD with self.strategy.scope():