'ImportError: cannot import name 'dtensor' from 'tensorflow.compat.v2.experimental'

I'm trying to create object detection using tensorflow as an assignment.

ImportError: cannot import name 'dtensor' from 'tensorflow.compat.v2.experimental' (c:\Project\.venv\lib\site-packages\tensorflow\_api\v2\compat\v2\experimental\__init__.py) I would appreciate any help!



Solution 1:[1]

I got the same error. I downgraded to Keras v2.6.0, which fixed the issue. Hence, as of 16.05.2022, this seems to be caues by a bug in v2.9.*

To downgrade to v2.6.0, run:

!pip install keras==2.6.*

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Anna Madsen