- 31 3月, 2023 1 次提交
-
-
由 Ainavo 提交于
-
- 17 3月, 2023 1 次提交
-
-
由 Nyakku Shigure 提交于
-
- 29 11月, 2022 1 次提交
-
-
由 Nyakku Shigure 提交于
-
- 03 11月, 2022 1 次提交
-
-
由 Nyakku Shigure 提交于
* [CodeStyle][py2][U008] remove unnecessary args in `super()` * remove remained args * revert changes in test_pylayer_op * Revert "revert changes in test_pylayer_op" This reverts commit ff185a9ae738afac3b0264f61bde6c6b7f72e7c4. * revert some changes in example code
-
- 23 10月, 2022 1 次提交
-
-
由 Nyakku Shigure 提交于
* update config * re-blacken python code * temporarily disable date and diff_py_file * skip a format
-
- 10 8月, 2022 1 次提交
-
-
由 Nyakku Shigure 提交于
[CodeStyle] use np.testing.assert_array_equal instead of self.assertTrue(np.array_equal(...)) (#44947) * automatically fix * update comments * numpy -> np * self.assertEqual(..., True) * wrong usage (err_msg=True) 这不是修复导致的错误,这些是原来 `self.assertTrue(..., True)` 的错误用法,因此在修复后将其认为位置参数 `err_msg` * some missing fix
-
- 27 6月, 2022 1 次提交
-
-
由 Aurelius84 提交于
* [Dy2Stat]Refactor convert_shape transformer logic * clean usless unittest
-
- 08 6月, 2022 1 次提交
-
-
由 Aurelius84 提交于
* [Dy2stat]Add RollBack into original dygraph function for @to_static * fix unittest
-
- 05 6月, 2022 1 次提交
-
-
由 Sing_chan 提交于
* use yapf to format all python file * yapf exclude two unittests file for they rely on writing and reading file, and format will break them * disable diff_py_file because too many diff files cause command following failed
-
- 20 10月, 2021 1 次提交
-
-
由 0x45f 提交于
* remove no_value using var.name * fix unit test for CI * fix unit test * add test case * fix test case * add more test case
-
- 11 3月, 2021 1 次提交
-
-
由 Aurelius84 提交于
* Fix bug with static_convert_var_shape * replace dot with dash
-
- 26 2月, 2021 1 次提交
-
-
由 Aurelius84 提交于
* fix eval_if_exist_else_none bug * fix typo * fix typo * fix test_op_num unittest
-
- 22 2月, 2021 1 次提交
-
-
由 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.
-
- 04 12月, 2020 1 次提交
-
-
由 Huihuang Zheng 提交于
Reduce exception type so that if covert_to_static failed, it reports right error message.
-
- 02 12月, 2020 1 次提交
-
-
由 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
-