解决keras backend 越跑越慢问题
作者:MSTK 时间:2022-05-27 17:36:58
Keras运行迭代一定代数以后,速度越来越慢,经检查是因为在循环迭代过程中增加了新的计算节点,导致计算节点越来越多,内存被占用完,速度变慢。
判断是否在循环迭代过程中增加了新的计算节点,可以用下面的语句:
tf.Graph.finalize()
如果增加了新的计算节点,就会报错,如果没有报错,说明没有增加计算节点。
补充知识:win10下pytorch,tensorflow,keras+tf速度对比
采用GitHub上的代码
运行类似vgg模型,在cifar10上训练,结果朋友torch与tensorflow速度相当,远远快过keras。
pytorch | tensorflow | keras+tensorflow | |
version | 0.4.0 | 1.8.0 | Keras: 2.1.6 Tensorflow: 1.8.0 |
train time: | 1min 14s | 1min 9s | 1min 51s |
evaluate time: | 378 ms | 9.4 s | 826 ms |
来源:https://www.cnblogs.com/mstk/p/10632406.html
标签:keras,backend
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
flask循环导入的问题解决
2023-10-01 10:28:52
Django中Forms的使用代码解析
2022-03-20 08:06:56
![](https://img.aspxhome.com/file/2023/9/84079_0s.png)
python绘制分组对比柱状图
2021-01-03 06:48:26
![](https://img.aspxhome.com/file/2023/5/97335_0s.jpg)
Python统计文件中去重后uuid个数的方法
2023-07-11 17:20:06
浅谈flask源码之请求过程
2023-12-17 10:36:48
Python tkinter实现图片标注功能(完整代码)
2022-08-11 07:07:33
Python计算一个给定时间点前一个月和后一个月第一天的方法
2023-11-26 13:50:26
Python使用add_subplot与subplot画子图操作示例
2022-12-15 13:14:28
![](https://img.aspxhome.com/file/2023/2/67812_0s.png)
深入浅析python 协程与go协程的区别
2022-02-16 23:57:26
一个jquery日期选取插件源码
2009-12-23 19:15:00
![](https://img.aspxhome.com/file/UploadPic/20101/11/2009126213743-92s.png)
在VS2017中用C#调用python脚本的实现
2021-09-19 00:59:06
ASP 常见的连接字符串写法(access2007)
2011-03-25 10:40:00
virtualenv实现多个版本Python共存
2021-11-27 00:50:44
![](https://img.aspxhome.com/file/2023/6/64706_0s.png)
Golang中goroutine和channel使用介绍深入分析
2023-07-07 16:51:48
PyTorch中view()与 reshape()的区别详析
2023-11-16 05:45:23
![](https://img.aspxhome.com/file/2023/1/128791_0s.png)
python 实现在Excel末尾增加新行
2023-11-26 09:27:52
pytorch打印网络结构的实例
2023-11-04 15:15:51
![](https://img.aspxhome.com/file/2023/8/95868_0s.jpg)
浅谈python 中的 type(), dtype(), astype()的区别
2022-09-13 22:40:39
Python中jieba库的使用方法
2021-06-23 13:47:24
![](https://img.aspxhome.com/file/2023/1/77821_0s.png)
Go gRPC服务客户端流式RPC教程
2023-07-16 06:08:55