1. 04 6月, 2021 1 次提交
    • H
      [Dy2stat] Add Support for paddle.grad (#33110) · 82630f38
      Huihuang Zheng 提交于
      This PR made these changes to support double grad:
      
      1. Translate `paddle.grad` to `paddle.static.gradients` to support double grad for dy2stat.
      2. Fix IfElseTransformer bug which may not change value if "Store before Load" variable is in "Store" statement is in IfElse conditional statement
      3. Add `DOut` to support double grad variables in `run_program_op`
      4. Add support for renaming for double grads for `jit.save/load`
      82630f38
  2. 26 10月, 2020 1 次提交
  3. 20 10月, 2020 1 次提交
  4. 17 9月, 2020 1 次提交
  5. 28 8月, 2020 1 次提交
    • L
      [Dy2Stat] Add debugging and logging mechanism for dygraph to static (#26457) · b1f9ed60
      liym27 提交于
      * [Dy2Stat] Add debugging and logging mechanism for dygraph to static. 
      
      * Remove TransformerError temporarily. 
      
      * import mock in PY2, from unittest import mock in PY3. test=develop
      
      * Expose interfaces set_code_level and set_verbosity in paddle.jit, fix doc of the two interface. 
      
      * polish doc of set_verbosity and set_code_level. 
      b1f9ed60
  6. 26 8月, 2020 1 次提交
  7. 05 7月, 2020 1 次提交
  8. 29 6月, 2020 1 次提交
    • H
      [Dy2stat] Add Basic Support for Grammar 'return' (#25176) · 6f631a27
      Huihuang Zheng 提交于
      This PR added basic support for 'return' grammar in dy2stat. It supports the control flow of 'return'.
      
      The basics idea is using a return value variable to store the early return statements and boolean state variables with if-else to skip the statements after the return statements.
      
      **This PR is very basic support. There are some corner cases I didn't develop/test**. For example, 'return None', 'return different length of variables', 'return non-tensor and tensor together', 'no return statement'. **These corner cases will be done in my next PRs**. Target date is this week.
      
      **Note**: 
      1. for the unit test, I changed test_program_translator.py because the StaticCode of `dyfunc_with_if_else` will change. To guarantee the correctness of `dyfunc_with_if_else`, I also run it in `TestRecursiveReturn` in test_return.py.
      
      2. I commented the early return code in bert_dygraph_model.py because 'return different length of variables' is unsupported now. I also know that there are some other models used early return and we didn't enable it in the unit test. I will add support for it in next PRs and then re-enable those tests.
      6f631a27
  9. 19 6月, 2020 1 次提交
  10. 05 6月, 2020 1 次提交
    • L
      [Dy2Static] Add convert_ifelse to run the transformed code dynamically (#24866) · a9dca580
      liym27 提交于
      * cast var in convert_logical_XX. 
      
      * Add convert_ifelse function in convert_operators.py  
      
      * Add logical_transformer. Remove LogicalTransformer from loop_transformer.py 
      
      * Revert modified tests in PR24799(convert_while_stmt). 
      
      * Comment and modify code that doesn't support `return` statement. 
      
      * Remove unnecessary class: MergeAssignTransformer, NodeTestTransformer and IfConditionVisitor in ifelse_transformer. 
      a9dca580
  11. 14 5月, 2020 1 次提交
  12. 08 5月, 2020 1 次提交
  13. 27 4月, 2020 1 次提交
    • C
      [dy2static] Add print transformer and unify print format (#24068) · 9b851ba2
      Chen Weihang 提交于
      * add print transformer & unify print format, test=develop
      
      * remove using of dygraph_to_static_func, test=develop
      
      * remove python stdout capture, test=develop
      
      * fix compatibility problems for PY2, test=develop
      
      * fix detail error, test=develop
      
      * fix type analysis bug, test=develop
      
      * fix print tuple compatible error in PY2, test=develop
      
      * replace get_func to declarative, test=develop
      
      * fix detail bug, test=develop
      
      * fix some detail problems, test=develop
      
      * change visit_call in print transformer, test=develop
      9b851ba2
  14. 19 4月, 2020 2 次提交
  15. 18 4月, 2020 1 次提交
  16. 17 4月, 2020 2 次提交
  17. 26 3月, 2020 1 次提交
  18. 25 3月, 2020 1 次提交
    • H
      Rename Decorator "dygraph_to_static_graph" to "dygraph_to_static_func" (#23150) · e9b18c74
      Huihuang Zheng 提交于
      This PR does exact the thing as the title. The reason is that we plan to develop 4 decorators
      
      "dygraph_to_static_code"
      "dygraph_to_static_program"
      "dygraph_to_static_func"
      "dygraph_to_static_output"
      
       The 4 decorators will emphasize different part when translating dygraph to static graph. Decorator name "dygraph_to_static_graph" is too big for the function it implements.
      e9b18c74
  19. 19 3月, 2020 2 次提交
  20. 17 3月, 2020 1 次提交
  21. 12 3月, 2020 1 次提交
  22. 11 3月, 2020 1 次提交
  23. 10 3月, 2020 1 次提交
  24. 07 3月, 2020 1 次提交
  25. 06 3月, 2020 1 次提交
  26. 05 3月, 2020 1 次提交
  27. 04 3月, 2020 2 次提交
  28. 28 2月, 2020 1 次提交
    • L
      fix dygraph_to_static_ouput and add a new decorator. (#22785) · 68a92e46
      liym27 提交于
      * change dygraph_to_static_output to dygraph_to_static_graph. test=develop
      
      * Remove duplicate code. test=develop
      
      * Follow comments from Liujie. test=develop
      
      * change dygraph_to_static_output to dygraph_to_static_graph. test=develop
      68a92e46
  29. 27 2月, 2020 1 次提交
  30. 24 2月, 2020 2 次提交
    • A
      Add IsControlFlowIfVisitor in ast_transformer (#22709) · dab5e5d8
      Aurelius84 提交于
      * add is_control_flow_if  test=develop
      dab5e5d8
    • L
      support dygraph basic api transformed to static api (#22678) · 68c76793
      liym27 提交于
      * support dygraph to static graph for simple case.
      
      * add test for dygraph API recognition. test=develop
      
      * support basic to_variable api. test=develop
      
      * update dict: dygraph_class_to_static_api
      
      * add all tests of dygraph api. test=develop
      
      * use gast/astor instead of ast/codegen for the compatibility of PY2 and PY3. test=develop
      
      * add arg 'num_flatten_dims' for fc ast node. test=develop
      
      * Modify names of class by Camel-Case.
      68c76793
  31. 20 2月, 2020 2 次提交
    • A
      Support if/else in dygraph_to_static (#22540) · 08b09f64
      Aurelius84 提交于
      * support nested if/else
      
      * support to derivate returns the parameter list automatically
      
      * polish tranform function of slice
      
      * fix modify x.numpy()[i] slice function
      
      * support to transform ast.node into callable function
      
      * fix get_name_ids bug and add more unittest test=develop
      
      * fix requirements.txt test=develop
      
      * remove useless import statement test=develop
      
      * Fixed version compatibility issues in param of function test=develop
      
      * use decorater to test ast_to_func test=develop
      
      * add textwrap.dedent for source_code test=develop
      
      * polish code comment
      
      * fix compatibility with python2 and python3 test=develop
      
      * fix gast version error test=develop
      
      * fix gast repo test=develop
      
      * polish transfer_from_node_type code test=develop
      
      * add nested_if_else unittest test=develop
      
      * split IfElseTransformer test=develop
      
      * specify gast version test=develop
      
      * fix ast_to_func root type test=develop
      08b09f64
    • H
      Add Basic Node Var Type Analysis (#22603) · 14672a63
      Huihuang Zheng 提交于
      1. Move AstNodeWrapper, StaticAnalysisVisitor to a new python file: static_analysis.py
      2. Add basic node var type analysis
      14672a63
  32. 18 2月, 2020 1 次提交
  33. 13 2月, 2020 1 次提交
  34. 10 2月, 2020 1 次提交