【paddlepaddle】EnforceNotMet: Invoke operator dropout_grad error. 解决方案

本文解决了一个在PaddlePaddle中克隆训练模型生成测试模型时遇到的错误,通过使用两个独立的Program并调整clone操作的位置,避免了测试集影响训练集的问题,确保了模型训练的正确性和效率。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 paddlepaddle 当试图clone训练模型来生成测试模型的时候,遇到了这种奇葩错误

(但是手写数字识别不会出现这个bug)

 

解决方案来自@家行hang同学

main_program = fluid.Program()
startup_program = fluid.Program()
with fluid.program_guard(main_program,startup_program):
    .......
    .......

创建两个program然后采用上述方式进行其余操作,用两个program替换掉fluid.default_main_program和fluid.default_startup_program即可。这样可以不让测试集影响训练集训练,而且也不会报错。

 

此外另一个坑点在教程中有说明:

clone操作一定要在定义优化器之前进行,否则也是会报错的。 

 

初始化异常: TypeError: __WEBPACK_IMPORTED_MODULE_2_babel_runtime_core_js_promise___default.a.allSettled is not a function at VueComponent._callee$ (cmmsEquipmentInfoDetail.vue:291:1) at tryCatch (runtime.js:62:15) at Generator.invoke [as _invoke] (runtime.js:296:1) at prototype.<computed> [as next] (runtime.js:114:1) at step (asyncToGenerator.js:17:1) at asyncToGenerator.js:35:1 at new Promise (<anonymous>) at new F (_export.js:36:1) at asyncToGenerator.js:14:1 at VueComponent.init (cmmsEquipmentInfoDetail.vue:317:1) _callee$ @ cmmsEquipmentInfoDetail.vue:313 tryCatch @ runtime.js:62 invoke @ runtime.js:296 prototype.<computed> @ runtime.js:114 step @ asyncToGenerator.js:17 (匿名) @ asyncToGenerator.js:35 F @ _export.js:36 (匿名) @ asyncToGenerator.js:14 init @ cmmsEquipmentInfoDetail.vue:317 boundFn @ vue.esm.js:186 (匿名) @ cmmsEquipmentInfo.vue:326 (匿名) @ vue.esm.js:1783 flushCallbacks @ vue.esm.js:1704 ./node_modules/core-js/modules/_invoke.js.module.exports @ _invoke.js:5 queue.<computed> @ _task.js:35 run @ _task.js:21 listener @ _task.js:25 cmmsEquipmentInfoDetail.vue:314 Uncaught (in promise) TypeError: _this.useRowDataAsFallback is not a function at VueComponent._callee$ (cmmsEquipmentInfoDetail.vue:314:1) at tryCatch (runtime.js:62:15) at Generator.invoke [as _invoke] (runtime.js:296:1) at prototype.<computed> [as next] (runtime.js:114:1) at step (asyncToGenerator.js:17:1) at asyncToGenerator.js:35:1 at new Promise (<anonymous>) at new F (_export.js:36:1) at asyncToGenerator.js:14:1 at VueComponent.init (cmmsEquipmentInfoDetail.vue:317:1)
最新发布
06-11
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值