Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions keras_tuner/backend/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import keras
import os


def _multi_backend():
if os.environ.get("TF_USE_LEGACY_KERAS", None) in ("true", "True", "1"):
from tensorflow import keras
_MULTI_BACKEND = False
else:
import keras
version_fn = getattr(keras, "version", None)
return version_fn and version_fn().startswith("3.")


_MULTI_BACKEND = _multi_backend()
_MULTI_BACKEND = version_fn and version_fn().startswith("3.")


def multi_backend():
Expand Down