1. 29 3月, 2023 1 次提交
  2. 22 3月, 2023 1 次提交
  3. 20 3月, 2023 1 次提交
    • G
      Fluid clean move out fill constant (#49511) · c985b1ac
      GGBond8488 提交于
      * migrate fill_constant to paddle.tensor
      
      * move fill_constant to paddle.tensor and repalce the reference
      
      * add missing fill_constant replacement
      
      * fix typro
      
      * remove unused import fill_constant
      
      * fix zeros import error
      
      * fix circle import
      
      * fix layers.zeros
      
      * fix unitest
      
      * fix unitests
      
      * fix unitest
      
      * use paddle.full replace fill_constant in samplecode
      
      * fix sample code
      
      * recovery xpu test
      
      * recovery xpu test
      
      * fix circle import
      
      * fix utils import error
      
      * fix utils error
      
      * fix circle import
      
      * redo
      
      * fix circle import
      
      * fix prim fill constant import
      
      * fix type error
      
      * fix increase error
      
      * fix test error
      
      * fix fill_constant
      c985b1ac
  4. 13 3月, 2023 1 次提交
    • 【Hackathon No.89】 Remove circle import Part2 (#51199) · 34358de5
      张春乔 提交于
      * fix the only one circle import in call_transformer.py
      
      * move define of CONVERSION_OPTIONS from convert_call_func.py to program_translator.py
      
      * delete the self import of program_translator.py
      
      * fix import failed problem
      
      * define variable in utils.py
      
      * move is_builtin to utils.py
      
      * move is_builtin to utils.py
      
      * fix import errors
      
      * fix import errors
      
      * fix something
      
      * Update python/paddle/jit/dy2static/call_transformer.py
      Co-authored-by: NAurelius84 <zhangliujie@baidu.com>
      
      * Update python/paddle/jit/dy2static/call_transformer.py
      
      ---------
      Co-authored-by: NAurelius84 <zhangliujie@baidu.com>
      34358de5
  5. 09 3月, 2023 1 次提交
    • Z
      Remove paddle.fluid.layers.utils.* (#51033) · 86e990d4
      zqw_1997 提交于
      * move fluid.utils to paddle.utils.layers_utils
      
      * fix error
      
      * delete original fluid layers utils
      
      * remove import and old utils
      
      * remove more old utils import
      
      * change import path of fill_constant in the layers_utils.py
      
      * fix mistake
      
      * fix error
      
      * expose in __init__.py
      
      * for comment
      
      * when change the ref of func is_sequence, it should change to the root of is_sequence instead
      
      * for codecheck
      86e990d4
  6. 20 2月, 2023 1 次提交
  7. 14 2月, 2023 1 次提交
  8. 30 12月, 2022 1 次提交
  9. 14 12月, 2022 1 次提交
  10. 13 12月, 2022 1 次提交
  11. 12 12月, 2022 1 次提交
  12. 08 12月, 2022 1 次提交
  13. 05 12月, 2022 2 次提交
  14. 02 12月, 2022 3 次提交
  15. 01 12月, 2022 1 次提交
  16. 29 11月, 2022 1 次提交
  17. 23 10月, 2022 1 次提交
  18. 27 9月, 2022 1 次提交
  19. 29 8月, 2022 1 次提交
  20. 12 7月, 2022 1 次提交
    • X
      [ Dy2Static ]Change NameVisitor in while to FunctionScopeAnalysis (#44155) · c5c6026e
      xiongkun 提交于
      * change NameVisitor to FunctionScopeAnalysis
      
      * polish the logic of undefined var in while_loop. create vars after body execution
      
      * replace old NameVisitor in while and fix all CI
      
      * Togather with CreateVariableTransformer
      
      * add create_variable_transformer
      
      * fix bugs
      
      * merge
      
      * fix some error, TODO: ForNodePreTransform ahead
      
      * merge for unite PR
      
      * fix conflict with base_transformer PR
      
      * fix ci errors, fix [for i in range()] error
      
      * fix according to code review
      c5c6026e
  21. 27 6月, 2022 1 次提交
  22. 11 6月, 2021 1 次提交
  23. 22 2月, 2021 1 次提交
    • H
      [Dy2stat] Refactoring tensor_shape_transformer.py to Fix Change after Assign Bug (#31082) · cf43a321
      Huihuang Zheng 提交于
      **Problem**
      In our old shape transformer logic, if user write:
      ```
      s = tensor.shape
      ...
      y = paddle.some_api(s)
      ```
      Dy2stat will change it to
      ```
      ...
      y = paddle.some_api(convert_var_shape(tensor))
      ```
      However it will cause fatal bug if user changes the shape of `x` after assign. For example:
      ```
      s = tensor.shape
      ...
      tensor = paddle.some_change_shape_api(tensor)
      ...
      y = paddle.some_api(s)
      ```
      Then the Dy2stat will get wrong result because the code is translated into:
      ```
      tensor = paddle.some_change_shape_api(tensor)
      ...
      y = paddle.some_api(convert_var_shape(tensor)) # tensor shape has been changed, not origin `s` value
      ```
      
      **Solution Logic**
      
      It can not be solved in the old logic, so I refactoring tensor_shape_transformer logic. Now we will use `s` to store shape attribute and generate a var `s__STATIC_CONVERT_VAR_SHAPE_SUFFIX` to store static shape API `shape(tensor)`
      ```
      s = tensor.shape
      ...
      y = paddle.some_api(s)
      ```
      Dy2stat will change it to
      ```
      s = tensor.shape
      s__STATIC_CONVERT_VAR_SHAPE_SUFFIX = shape(tensor)
      ...
      y = paddle.some_api(choose_shape_attr_or_api(s, s__STATIC_CONVERT_VAR_SHAPE_SUFFIX ))
      ```
      In this case, the code is consistent with origin dygraph meaning and it fixed the change after assign bug.
      
      **Code Key Note**
      
      To help reviewers, the key change of this PR is changing `self.name_to_var_shape` from "mapping name to shape node" to "mapping name to its STATIC_CONVERT_VAR_SHAPE_SUFFIX name", then if a variable name has the SUFFIX, we can choose to use attribute shape or shape api. Other changes go with the key change.
      
      **Consideration**
      The issue of this PR is that we store extra static `shape` API result, will it harms the speed of Dy2stat? In some cases it will, but we argue that the benefit would be greater than the cost.
      
      1. The extra calling to static `shape` API will happen when coder assign among shape variables. Take the following dygraph code as an instance:
      ```
      s1 = tensor.shape
      s2 = s1
      s3 = s2
      ...
      ```
      Then we called extra static `shape` APIs again and again, however users seldom write code like this.
      
      2. If the shape variable is used a lot, for example:
      ```
      s = tensor.shape
      y1 = paddle.some_api1(s)
      y2 = paddle.some_api2(s)
      y3 = paddle.some_api3(s)
      ```
      Our old logic will create 3 shape APIs but now just 1. This is more common user code pattern. In fact, if reviewers take a look at the current unit test in this PR, you could see the op numbers decrease after this PR. So we argue that this PR can also improve speed in this code pattern.
      cf43a321
  24. 02 12月, 2020 1 次提交
    • H
      [Dy2stat] Fix PaddleGan Deoldify Model Dy2stat Problems (#29226) · aec05d81
      Huihuang Zheng 提交于
      This PR fixes several problems in dy2stat for Deoldify model in PaddleGan.
      
      In model, software engineer wrote if x.shape == y.shape, the Tenser shape is a tuple in dygraph so the == returns True/False, but in static graph the == becomes element-wise comparison, which is a different behavior. In this PR we reduce the element-wise comparison result.
      
      If software engineer write computations which uses parameters in hooks, the static graph can loss the parameter variable because we put param_guard at forward of a Layer. In this PR we made param_guard cover pre-hook and post-hook.
      
      In PaddleGan, software engineer calculated some parameter values in __init__ by running some dygraph code. Those code also run during dy2stat. So some variables may be assign as a VarBase (Tensor) first and then Variable, which raised an error. We fixed the bug in this PR by handling the case.
      
      TODO: We just added testcase for the 1. shape comparison. Should add test case for 2. and 3. But since we are chasing 2.0RC, I will do it in the near future PR
      aec05d81
  25. 25 11月, 2020 1 次提交
  26. 29 9月, 2020 1 次提交
    • H
      [Dy2stat] Refine Dy2stat APIs to 2.0rc (#27430) · cc2fc938
      Huihuang Zheng 提交于
      Refine Dy2stat APIs to 2.0rc
      
      After discussion, we accepted 3 key points from reviewers:
      
      1. In 2.0rc we changed dygraph_to_static folder to dy2static
      2. Keep the three files: convert_call_func.py, convert_operators.py, variable_trans_func.py
      3. Remove convert_operators path when users import convert_xxx. 
      
      After this PR, users can import convert_xxx APIs by:
      
      `import paddle.jit.dy2static.convert_xxx`
      
      The file structure will be:
      
      ```
      jit
          dy2static
                convert_operators.py
                convert_func_call.py
                variable_trans_func.py
      ```
      
      Detail changed API in files:
      
      In python/paddle/jit/dygraph_to_static/convert_call_func.py:
      from ...fluid.dygraph.dygraph_to_static.convert_call_func import convert_call  #DEFINE_ALIAS
      
      In python/paddle/jit/dygraph_to_static/convert_operators.py:
      from ...fluid.dygraph.dygraph_to_static.convert_operators import cast_bool_if_necessary  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_assert  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_ifelse  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_len  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_logical_and  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_logical_not  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_logical_or  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_print  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_var_dtype  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_var_shape  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.convert_operators import convert_while_loop  #DEFINE_ALIAS
      
      In python/paddle/jit/dygraph_to_static/variable_trans_func.py:
      from ...fluid.dygraph.dygraph_to_static.variable_trans_func import create_fill_constant_node  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.variable_trans_func import create_static_variable_gast_node  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.variable_trans_func import data_layer_not_check  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.variable_trans_func import to_static_variable  #DEFINE_ALIAS
      from ...fluid.dygraph.dygraph_to_static.variable_trans_func import to_static_variable_gast_node  #DEFINE_ALIAS
      cc2fc938