ImportError: cannot import name 'dtensor'

My TX2 makes the following error when running “from tensorflow.keras import layers” :“ImportError: cannot import name ‘dtensor’”, tensorflow is version 2.7, is this the version problem? What is the solution,

When running on a PC, tensorflow is version 2.12, and keras is not installed separately, and everything is fine

Hi,

Maybe the below link can help you:

Thanks.

The latest tensorflow should include keras. I have never installed KERAS separately on PC, so there is no version mapping relationship. Does tensorflow2.7 not include KERAS, do I need to install keras separately? What is the keras version number corresponding to tensorlfow2.7, if required?

How do I check the keras version,“ ImportError: cannot import name ‘dtensor’” is still reported when running “print(keras.version)”

Hi,

We just give it a try.
Reinstalling Keras with 2.6 can fix this issue.

$ pip3 install keras==2.6
Defaulting to user installation because normal site-packages is not writeable
Collecting keras==2.6
  Downloading keras-2.6.0-py2.py3-none-any.whl (1.3 MB)
     |████████████████████████████████| 1.3 MB 1.9 MB/s
Installing collected packages: keras
Successfully installed keras-2.6.0
nvidia@tegra-ubuntu:~$ python3
Python 3.6.9 (default, Mar 10 2023, 16:46:00)
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import keras
>>> keras.__version__
'2.6.0'

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.