'Error: import tensorflow.keras.backend as K could not be resolved Pylance(reportMissingImports)
I'm using tensorflow 1.15.0 in docker container and have issue in importing keras sub-modules.
from tensorflow import keras
import tensorflow.keras.backend as K
from tensorflow.keras.optimizers import Adam, SGD
Both backend and Adam, SGD cannot be imported.
Any solutions for this ?
Solution 1:[1]
I know that is too late, but I confronted the same issue and I just wanted to share the solution that worked successfully for me try to use this instead :
import tensorflow as tf
import keras
from keras import backend as k
at least you can use Adam() like this :
tf.keras.optimizers.Adam()
the same goes for SGD() :
tf.keras.optimizers.SGD()
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 | lyylia |