PyCharm reports an unresolved reference for Keras modules with TensorFlow 2

I am using the following specifications.

PyCharm 2019.2.5 (Professional Edition)
Build #PY-192.7142.56, built on November 19, 2019
Runtime version: 11.0.4+10-b304.77 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15
GC: ParNew, ConcurrentMarkSweep
Memory: 725M
Cores: 8

The problem I am facing is that PyCharm is not able to auto-complete certain imports and tells me that there is an "unresolved reference" for (all) Keras modules. More specifically, if I try to import e.g.

from tensorflow.keras.layers import Dense

PyCharm tells me that Dense is an unresolved reference, even though I can run the script without getting an error. This apparently happens for Keras modules imported from the tensorflow package. Furthermore, the auto-complete does not work, more precisely, if I type

from tensorflow.k

It does not perform auto-completion.

 

This issue is related to https://stackoverflow.com/q/58188704/3924118, but I am not getting any error, it's just annoying that I cannot perform auto-completion and PyCharm always tells me that those are unresolved references.

0
1 comment

What tensorflow version do you use?

There is a known issue with 2.0.0rc2 https://youtrack.jetbrains.com/issue/PY-38220

0

Please sign in to leave a comment.