Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importerror fixed #237

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
7 changes: 5 additions & 2 deletions nengo_dl/compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ def filter(self, record):
BatchNormalizationV1,
BatchNormalizationV2,
)
elif version.parse(tf.__version__) >= version.parse("2.9.0"):
from tensorflow.python.keras.engine.functional import Functional, _build_map
from tensorflow.keras.layers import BatchNormalization
else:
from keras.engine.functional import Functional, _build_map
from keras.layers import BatchNormalizationV1, BatchNormalizationV2
from keras.engine.functional import Functional, _build_map # this is deprecated
from keras.layers import BatchNormalizationV1, BatchNormalizationV2 # this is deprecated

if version.parse(tf.__version__) < version.parse("2.5.0rc0"):

Expand Down
3 changes: 1 addition & 2 deletions nengo_dl/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -1141,8 +1141,7 @@ def convert(self, node_id):
return super().convert(node_id, dimensions=3)


@Converter.register(compat.BatchNormalizationV1)
@Converter.register(compat.BatchNormalizationV2)
@Converter.register(compat.BatchNormalization)
class ConvertBatchNormalization(LayerConverter):
"""Convert ``tf.keras.layers.BatchNormalization`` to Nengo objects."""

Expand Down