没有合适的资源?快使用搜索试试~ 我知道了~
首页问题解决:AttributeError: module ‘paddle.fluid’ has no attribute ‘EndStepEvent’
问题解决:AttributeError: module ‘paddle.fluid’ has no attribute ‘End...
5星 · 超过95%的资源 14 下载量 84 浏览量
更新于2023-03-16
评论
收藏 56KB PDF 举报
问题解决:AttributeError: module ‘paddle.fluid’ has no attribute ‘EndStepEvent’问题描述解决思路问题解决 问题描述 在使用paddle.fluid导入EndStepEvent过程中 global step if isinstance(event, fluid.EndStepEvent): if event.step == 0: plot_cost.append('Train Cost', step, event.metrics[0]) plot
资源详情
资源评论
资源推荐
问题解决:问题解决:AttributeError: module ‘paddle.fluid’ has no
attribute ‘EndStepEvent’
问题解决:问题解决:AttributeError: module ‘paddle.fluid’ has no attribute ‘EndStepEvent’问题描述解决思路问题解决
问题描述问题描述
在使用paddle.fluid导入EndStepEvent过程中
global step
if isinstance(event, fluid.EndStepEvent):
if event.step % 10 == 0:
plot_cost.append('Train Cost', step, event.metrics[0])
plot_cost.plot()
其中if isinstance(event, fluid.EndStepEvent):报错
Traceback (most recent call last):
File "D:/xxx.py", line 160, in
trainer.train(reader=train_reader, num_epochs=200, event_handler=event_handler_plot, feed_order=feed_order)
File "C:trainer.py", line 405, in train
feed_order)
File "C:trainer.py", line 483, in _train_by_executor
self._train_by_any_executor(event_handler, exe, num_epochs, reader)
File "C:trainer.py", line 495, in _train_by_any_executor
event_handler(BeginEpochEvent(epoch_id))
File "D:xxx.py", line 138, in event_handler_plot
if isinstance(event, fluid.EndStepEvent):
AttributeError: module 'paddle.fluid' has no attribute 'EndStepEvent'
解决思路解决思路
在对于高层API,PaddlePaddle在版本1.0之后做了很大的改动,比如就修改了高层API所在的位置。同时也完善了高层API的
很多功能。高层API虽然没有底层API灵活,但高层API使用更简单,非常适合初学者使用。
在PaddlePaddle 1.0以上的版本,高级API已经迁移到paddle.fluid.contrib目录下,所以在导包的是应该要使用from
paddle.fluid.contrib.trainer import *的导包方式。也就是说在PaddlePaddle 1.0以上的版本,EndStepEvent并不存在于fluid中,而是存在
于fluid.contrib.trainer中。
问题解决问题解决
在PaddlePaddle 1.0以上的版本,高级API已经迁移到paddle.fluid.contrib目录下,所以在导包的是应该要使用from
paddle.fluid.contrib.trainer import *的导包方式。
导入资源方法:
from paddle.fluid.contrib.trainer import EndStepEvent
同时将if isinstance(event, fluid.EndStepEvent):改为
if isinstance(event, EndStepEvent):
ywsydwsbn
原创文章 58获赞 115访问量 1万+
weixin_38698863
- 粉丝: 1
- 资源: 921
上传资源 快速赚钱
- 我的内容管理 收起
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
会员权益专享
最新资源
- 面 向 对 象 课 程 设 计(很详细)
- 复杂可编程逻辑器件ppt课件.ppt
- 2021.12-2021居住客群消费趋势年报-贝壳-20页.pdf
- (完整word版)基于单片机的智能交通灯控制系统设计.doc
- 四川天羚绒业公司电子商务营销策略研究.docx
- TI-DS125BR111.pdf
- Oracle培训基础1.ppt
- SAP-Warehouse-Insights-中文介绍
- sed&awk;手册
- MATLAB6.0数学手册精简版
- 年数据库技术大会万振龙数据治理与大数据平台设计40.pptx
- 计算机组装维修教程11
- 全国统一数据资产登记体系建设白皮书.pdf
- 北邮概率论与随机过程课件 教学内容: 1、事件的独立性; 2、伯努利试验概型。
- 电子商务与民航信息化(PPT).ppt
- SAP等公司的面试题
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论5