Skip to content

Commit

Permalink
Cleanup the legacy conditional import for dtensor in keras
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 551267421
  • Loading branch information
qlzh727 authored and tensorflower-gardener committed Jul 26, 2023
1 parent bdfb8aa commit ab566fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
3 changes: 3 additions & 0 deletions keras/dtensor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ package(
py_library(
name = "dtensor",
srcs = ["__init__.py"],
deps = [
"//:expect_tensorflow_installed",
],
)

tf_py_test(
Expand Down
10 changes: 1 addition & 9 deletions keras/dtensor/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,5 @@
# ==============================================================================
"""Keras' DTensor library."""

_DTENSOR_API_ENABLED = True


# Conditional import the dtensor API, since it is currently broken in OSS.
if _DTENSOR_API_ENABLED:
from tensorflow.compat.v2.experimental import dtensor as dtensor_api
else:
# Leave it with a placeholder, so that the import line from other python
# file will not break.
dtensor_api = None
from tensorflow.compat.v2.experimental import dtensor as dtensor_api

0 comments on commit ab566fd

Please sign in to comment.