1. 28 7月, 2021 1 次提交
  2. 27 7月, 2021 1 次提交
  3. 23 7月, 2021 1 次提交
  4. 22 7月, 2021 1 次提交
  5. 20 7月, 2021 1 次提交
  6. 15 7月, 2021 1 次提交
  7. 14 7月, 2021 1 次提交
  8. 05 7月, 2021 1 次提交
  9. 30 6月, 2021 1 次提交
  10. 24 6月, 2021 1 次提交
  11. 21 6月, 2021 1 次提交
  12. 17 6月, 2021 1 次提交
  13. 16 6月, 2021 1 次提交
  14. 09 6月, 2021 2 次提交
  15. 08 6月, 2021 1 次提交
  16. 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
  17. 20 5月, 2021 1 次提交
  18. 19 5月, 2021 1 次提交
  19. 30 4月, 2021 1 次提交
    • H
      [Dy2stat] Fix to_tensor Bug Reported from QA (#32701) · 00268194
      Huihuang Zheng 提交于
      Dy2stat failed when user writes return paddle.to_tensor(xxx), the reason is that visit_Expr doesn't work when the Expr is in return. Some other statements may trigger same bug. To fix it, we re-wrote a transformer to transform paddle.to_tensor to paddle.assign for all Call nodes.
      00268194
  20. 09 4月, 2021 2 次提交
  21. 24 3月, 2021 1 次提交
  22. 11 3月, 2021 1 次提交
  23. 04 3月, 2021 3 次提交
    • L
      522c91ec
    • H
      Fix comment (#31424) · c40b98e0
      Huihuang Zheng 提交于
      Fix wrong code comment
      c40b98e0
    • H
      [Dy2stat] Fix Read-Only Attribute as while_loop Output (#31415) · 6bf02a12
      Huihuang Zheng 提交于
      Fix Read-Only Attribute as while_loop Output:
      
      Usually, our convert_while_loop will be like:
      ```
          [a, b, c] = paddle.jit.dy2static.convert_while_loop(
                  condition_name, body_name, [a, b, c])
      ```
      where a, b, c are in loop_var_names.
      
      However, if loop_var_names contains property such as foo.x, we cannot
      assign the attribute as output of convert_while_loop because Python
      property is a kind of read-only attribute. To handle the case, we replace
      the attributes which are output of convert_while_loop with generated
      variables, then if we know the attribute is not read-only at runtime, we
      assign the attribute. The created statements are like:
      ```
          [a, b, __attribute_variable_1] = paddle.jit.dy2static.convert_while_loop(
                  condition_name, body_name, [a, b, foo.x])
          if not isinstance(getattr(type(foo), x, None), property): foo.x = __attribute_variable_1
      ```
      6bf02a12
  24. 26 2月, 2021 1 次提交
  25. 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
  26. 20 2月, 2021 1 次提交
  27. 18 2月, 2021 1 次提交
    • H
      Add Support for Tuple in for Loop (#30998) · c1375783
      Huihuang Zheng 提交于
      Dy2stat didn't support tuple as iteration variable in the past. This PR added there main cases:
      
             1). Non-enumerate case: for var1, var2 in var|var.numpy() will be re-written as:
                for FOR_ITER_TUPLE_PREFIX_x in var | var.numpy():
                  var1 = FOR_ITER_TUPLE_PREFIX_x[0]
                  var2 = FOR_ITER_TUPLE_PREFIX_x[1]
              2). Enumerate out tuple case: for t in enumerate(var|var.numpy) will be rewritten as:
                for FOR_ITER_TUPLE_INDEX_PREFIX_x, FOR_ITER_TUPLE_PREFIX_x in enumerate(var|var.numpy):
                  t = (FOR_ITER_TUPLE_INDEX_PREFIX_x, FOR_ITER_TUPLE_PREFIX_x)
              3). Enumerate inner tuple case: for i, (var1, (var2, va3)) in enumerate(var|var.numpy()) will
              be re-written as:
                for i, FOR_ITER_TUPLE_PREFIX_x in var | var.numpy():
                  var1 = FOR_ITER_TUPLE_PREFIX_x[0]
                  var2 = FOR_ITER_TUPLE_PREFIX_x[1][0]
                  var3 = FOR_ITER_TUPLE_PREFIX_x[1][1]
      c1375783
  28. 27 1月, 2021 1 次提交
  29. 20 1月, 2021 1 次提交
  30. 14 1月, 2021 1 次提交
  31. 11 1月, 2021 2 次提交
  32. 08 1月, 2021 3 次提交
  33. 21 12月, 2020 1 次提交