Tik0
Tik0

Reputation: 2699

tensorflow/keras utils module confusion between _api/v1/keras/ and python/keras

I just try to import vis_utils from tensorflow.keras but it gives me

>>> import tensorflow.keras.utils.vis_utils
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'tensorflow.keras.utils.vis_utils'

Checking the location of utils tells me that it points to the wrong (?) directory:

>>> print(tensorflow.keras.utils.__file__)
/usr/local/lib/python3.5/dist-packages/tensorflow/_api/v1/keras/utils/__init__.py

But it should actually point to /usr/local/lib/python3.5/dist-packages/tensorflow/python/keras/utils/__init__.py I've installed everything via pip and tf version is 1.12 on my vanilla Ubuntu 16.04. Is the installation tainted or how do tell python to load the correct module?

Upvotes: 1

Views: 1058

Answers (1)

sdcbr
sdcbr

Reputation: 7129

import tensorflow.python.keras.utils.vis_utils should work.

Upvotes: 2

Related Questions