进口Keras的问题
我在Jupyter笔记本上有一个功能性的程序。我将其下载为.py文件,但由于某种原因,我在jupyter中遇到的导入时会遇到错误,这并没有引起任何问题。 导入是:
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import *
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras.losses import MeanSquaredError
from tensorflow.keras.metrics import RootMeanSquaredError
from tensorflow.keras.optimizers import Adam
我会得到错误:
Import "tensorflow.keras.<name>" could not be resolved
这太奇怪了,因为唯一的区别是文件本身(从.ipynb到.py),它是相同的环境,甚至是相同的文件夹。
我有TensorFlow版本:2.8.0 和Python版本:3.10.4
I have a functioning program on a Jupyter notebook. I downloaded it as a .py file but, for some reason, I get errors while making the imports that, in jupyter, didn't cause any problems.
The imports are:
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import *
from tensorflow.keras.callbacks import ModelCheckpoint
from tensorflow.keras.losses import MeanSquaredError
from tensorflow.keras.metrics import RootMeanSquaredError
from tensorflow.keras.optimizers import Adam
and I get the errors:
Import "tensorflow.keras.<name>" could not be resolved
It's so weird since the only difference is the file itself (from .ipynb to .py), it's the same environment and even the same folder.
I have tensorflow version: 2.8.0
And python version: 3.10.4
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论