fix runtime crash when rnn model inference, test=develop (#31833) #31846
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
Bug fixes
PR changes
OPs
Describe
cherry-pick到release2.0分支。修复了rnn动态图转静态图后运行时崩溃问题。
1、recurrent op的输入tensor在memory_optimizer_pass中被重命名的话,会导致相应的子block中的op找不着输入tensor.报错。因此将recurrent op加入到了memory_optimizer_pass的skip列表。
2、recurrent op执行时的内存回收会导致局部输出被拷贝到全局之前被释放。因此在recurrent op的执行子块中关闭垃圾回收机制。
3、recurrent op的局部输出拷贝到全局的逻辑有误,进行了修复。
4、 batch_norm kernel在训练时少传递了一个is_test参数,导致底层的is_test采用了默认值,出现了训练前向时和静态图推理时不精度不一致的情况。进行了补充。