The autocomplete function of VS Code 1.41.1 does not work for example for
from tensorflow.keras import layers
(for tensorflow version 1.14.0) but it works for
from tensorflow.python.keras import layers
So what is the exact difference? Why does it work in the latter case? And is it always safe to replace the first method with the second, meaning it produces identical behavior by using the exact same methods?
So, thanks to thushv89 and some additional research I found some kind of explanation and solution:
https://github.com/microsoft/python-language-server/issues/818
The way TensorFlow handels imports cannot be read by VS Code easily. Using tf.python.keras
is a work around, but definitely not recommended. Other ways to solve this issue are described here:
使用 tensorflow 2.2 版时已解决此问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.