当前位置:网站首页>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
- CVPR best paper winner Huang Gao's team from Tsinghua University presented the first dynamic network review
- ES6 Set、WeakSet
- ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
- Service
- In Opencv, imag=cv2.cvtColor(imag,cv2.COLOR_BGR2GRAY) error: error:!_src.empty() in function 'cv::cvtColor'
- 如何编写一个优雅的Shell脚本(二)
- npm搭建本地服务器,直接运行build后的目录
- [Go through 7] Notes from the first section of the fully connected neural network video
- flink部署操作-flink standalone集群安装部署
猜你喜欢
ECCV2022 | RU&谷歌提出用CLIP进行zero-shot目标检测!
【Pytorch学习笔记】10.如何快速创建一个自己的Dataset数据集对象(继承Dataset类并重写对应方法)
[After a 12] No record for a whole week
Flink Distributed Cache 分布式缓存
Machine Learning (1) - Machine Learning Fundamentals
哥廷根大学提出CLIPSeg,能同时作三个分割任务的模型
SQL (2) - join window function view
[Pytorch study notes] 9. How to evaluate the classification results of the classifier - using confusion matrix, F1-score, ROC curve, PR curve, etc. (taking Softmax binary classification as an example)
Day1:用原生JS把你的设备变成一台架子鼓!
The fourth back propagation back propagation
随机推荐
Lecture 3 Gradient Tutorial Gradient Descent and Stochastic Gradient Descent
day6-列表作业
6k+ star,面向小白的深度学习代码库!一行代码实现所有Attention机制!
flink中文文档-目录v1.4
js实现数组去重
如何跟踪网络路由链路&检测网络健康状况
序列基础练习题
Flink HA安装配置实战
Flutter 3.0升级内容,该如何与小程序结合
基于Flink CDC实现实时数据采集(二)-Source接口实现
flink项目开发-配置jar依赖,连接器,类库
A deep learning code base for Xiaobai, one line of code implements 30+ attention mechanisms.
【数据库和SQL学习笔记】9.(T-SQL语言)定义变量、高级查询、流程控制(条件、循环等)
[Go through 9] Convolution
day8字典作业
Flink和Spark中文乱码问题
原来何恺明提出的MAE还是一种数据增强
【Pytorch学习笔记】10.如何快速创建一个自己的Dataset数据集对象(继承Dataset类并重写对应方法)
flink yarn-session的两种使用方式
Machine Learning (1) - Machine Learning Fundamentals