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
Function optimization
PR changes
Others
Describe
为了动态图可以方便转正 这边重构了python端对于dygraph_mode和eager_mode的判断目的有两个1. 让eager在dygraph_mode下直接成为默认模式(依赖全局变量)不进行额外的二次判断 2. 修改test_eager_guard使其可以支持从eager->fluid,再从fluid->eager 这个修改较大 对于yaml迁移的同学来说 主要关注的是对于计算型api从


的调用形式变成了
具体flag的关系我在fluild/framework.py最开始做了注释解释。简单来说是将执行机制在python分成static和non_static通过_non_static_mode来判断,这里_non_static_mode等同于从前in_dygraph_mode的功能。而在_non_static_mode下区分是否是_in_legacy_dygraph如果是则运行老动态图,否则运行新动态图,而原来的in_dygraph_mode将作为进入新动态图执行模式的判断等同于之前in_eager_mode的功能呢,而之前的in_eager_mode将删除。