北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘

1.在运行下方代码时,遇到了

history = model.fit(x_train, y_train, batch_size=64, epochs=50,
                    validation_data=(x_test, y_test),
                    validation_freq=1,
                    callbacks=[cp_callback])

北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘

遇到了以下问题,即:

[En]

Encountered the following problem, namely:

'NoneType' object has no attribute 'dtype'

北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘

2.在百度搜索该错误,发现了一篇文章:TensorFlow问题:AttributeError: ‘NoneType’ object has no attribute ‘dtype’_sweetiedreams的博客-CSDN博客

这与我的错误完全相同,因此请参阅这篇文章,解决方案:

[En]

It’s exactly the same as my mistake, so see this article, solution:

目前使用的是TensorFlow2.1版本,于是将Numpy版本修改为1.18.5,发现问题得到解决。

3.根据上述方案,解决问题,目前我的numpy版本是:1.21.2(见下图)

我的思路是:(可参考文章:Numpy卸载与重装_多多有个梦想的博客-CSDN博客_卸载numpy)

  • 首先将原有的numpy卸载:
pip uninstall numpy
  • 重新安装指定版本的numpy:
pip install numpy==1.18.5

北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘

4.但是在卸载numpy时,出现了以下问题(见下图),即:

PermissionError: [WinError 5] 拒绝访问。: ‘d:\anaconda\envs\tensorflow2.1\lib\site-packages\numpy\(未完全显示)

北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘

所以,要寻找答案,根据文章解决错误,文章链接:

[En]

So, to search for the answer, according to the article to solve the error, the article link:

https://www.jb51.net/article/185218.htm

主要有以下几步:

*

第一步: 关闭跟python相关的所有程序,如jupyter,pycharm,Anaconda等等,这一步非常重要!!! 好了,第一步完成下面开始常规操作的两步:
*
第二步: 赋予用户对python的”完全控制”的权限,步骤如下: 找到按照python的位置,本文用的是Anaconda,安装在D盘,位置为:D:\Anaconda3。找到python->右键->属性->安全->点击”组或用户名”中的Users->编辑->点击点击”组或用户名”中的Users->把”完全控制”打钩->应用->OK

5.第4步完成后,在进行第3步,就可以了,重新运行代码,出现了如下界面,表明该问题已经解决。

北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘

6.但是在安装完numpy之后出现了下图中的问题,不过暂时没有有影响。

北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘

Original: https://blog.csdn.net/m0_61164502/article/details/120860634
Author: m0_61164502
Title: 北京大学曹建老师tensorflow慕课中在运行GRU模型时,history = model.fit()中遇到的问题:object has no attribute ‘dtype‘

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/514600/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球