当前位置:网站首页>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:
边栏推荐
- DOM and its applications
- 【零基础开发NFT智能合约】如何使用工具自动生成NFT智能合约带白名单可Mint无需写代码
- es6迭代协议
- 记我的第一篇CCF-A会议论文|在经历六次被拒之后,我的论文终于中啦,耶!
- flink基本原理及应用场景分析
- ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
- 【论文精读】ROC和PR曲线的关系(The relationship between Precision-Recall and ROC curves)
- BroadCast Receiver(广播)详解
- AIDL详解
- 基于Flink CDC实现实时数据采集(二)-Source接口实现
猜你喜欢
[Practice 1] Diabetes Genetic Risk Detection Challenge [IFLYTEK Open Platform]
大型Web网站高并发架构方案
CVPR best paper winner Huang Gao's team from Tsinghua University presented the first dynamic network review
AIDL详解
vscode要安装的插件
Kubernetes常备技能
The difference between the operators and logical operators
DOM and its applications
Machine Learning (1) - Machine Learning Fundamentals
flink实例开发-详细使用指南
随机推荐
BroadCast Receiver(广播)详解
【论文精读】ROC和PR曲线的关系(The relationship between Precision-Recall and ROC curves)
Thread handler句柄 IntentServvice handlerThread
【数据库和SQL学习笔记】5.SELECT查询3:多表查询、连接查询
flink on yarn 集群模式启动报错及解决方案汇总
AIDL详解
Lecture 2 Linear Model Linear Model
Tensorflow踩坑笔记,记录各种报错和解决方法
day7-列表作业(1)
转正菜鸟前进中的经验(废话)之谈 持续更新中... ...
RecycleView和ViewPager2
CVPR最佳论文得主清华黄高团队提出首篇动态网络综述
[Over 17] Pytorch rewrites keras
发顶会顶刊论文,你应该这样写作
day11-函数作业
DOM and its applications
Tensorflow2 与 Pytorch 在张量Tensor基础操作方面的对比整理汇总
MySql之索引
flink项目开发-flink的scala shell命令行交互模式开发
Flink Broadcast 广播变量