当前位置:网站首页>Tensorflow steps on the pit notes and records various errors and solutions
Tensorflow steps on the pit notes and records various errors and solutions
2022-08-05 05:38:00 【takedachia】
I don't know if it's an illusion, tensorflow is easier to report errors than pytorch, so record the pit you stepped on.
Update from time to time.
Article table of contents
0 When an error occurs, first replace the Jupyter notebook code with a .py file and run it directly
When there is an inexplicable error, if you are currently using Jupyter notebook, first replace it with a .py file and run it directly.
Especially the gpu version of tensorflow is prone to problems under Jupyter.
1 Loaded runtime CuDNN library: 7.4.1 but source was compiled with: 7.6.0
Initial environment: tensorflow2.0 (gpu), CUDA 10.0, Cudnn 7.4.1, Windows 10
Error training convolutional neural network (when using Conv2d class):
Loaded runtime CuDNN library: 7.4.1 but source was compiled with: 7.6.0.
However, the environmental requirements of official website of tensorflow2.0 (gpu) write CUDA 10.0, Cudnn 7.4, the misleading effect is obvious.
The error report directly prompts the solution, just upgrade Cudnn to 7.6.0, the upgrade method is the same as the installation method of Cudnn, go to Official websiteDownload the corresponding Cudnn version and overwrite the source file.Also refer to the references below.
2 Custom models cannot be saved
Environment: tensorflow2.0 (gpu), CUDA 10.0, Cudnn 7.6.0, Windows 10
Using tf.keras.models.save_model(model, 'path') to save model error:
ValueError: Model
cannot be saved because the input shapes have not been set. Usually, input shapes are automatically determined from calling .fit() or .predict(). To manually set the shapes, call model._set_inputs(inputs).
References:
1.stackoverflow
2.Github: Model cannot be saved because the input shapes havenot been set. #39906
My solution:
After model initialization, after specifying input_shape in build(), write model.compute_output_shape(input_shape=(None, 32, 32, 3))That's it.
Ready to save:
边栏推荐
猜你喜欢

【零基础开发NFT智能合约】如何使用工具自动生成NFT智能合约带白名单可Mint无需写代码

DOM and its applications

CAP+BASE

6k+ star,面向小白的深度学习代码库!一行代码实现所有Attention机制!

ECCV2022 | RU & Google propose zero-shot object detection with CLIP!

Calling Matlab configuration in pycharm: No module named 'matlab.engine'; 'matlab' is not a package

【Pytorch学习笔记】11.取Dataset的子集、给Dataset打乱顺序的方法(使用Subset、random_split)

Mysql-连接https域名的Mysql数据源踩的坑
![[Over 17] Pytorch rewrites keras](/img/a2/7f0c7eebd119373bf20c44de9f7947.png)
[Over 17] Pytorch rewrites keras

Flink Broadcast 广播变量
随机推荐
[Remember 1] June 29, 2022 Brother and brother double pain
如何编写一个优雅的Shell脚本(一)
ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
怎样在Disciples门徒获得收益?
基于Flink CDC实现实时数据采集(二)-Source接口实现
【数据库和SQL学习笔记】7.SQL中的插入(INSERT)、删除(DELETE)、更新(UPDATE)
flink项目开发-配置jar依赖,连接器,类库
day12函数进阶作业
机器学习(一) —— 机器学习基础
MySQL
6k+ star,面向小白的深度学习代码库!一行代码实现所有Attention机制!
转正菜鸟前进中的经验(废话)之谈 持续更新中... ...
Flink Distributed Cache 分布式缓存
Flink Broadcast 广播变量
Day1:用原生JS把你的设备变成一台架子鼓!
el-pagination分页分页设置
BFC详解(Block Formmating Context)
实现跨域的几种方式
CAP+BASE
全尺度表示的上下文非局部对齐