- 20 5月, 2021 1 次提交
-
-
由 Aurelius84 提交于
* [Custom Op]Remove PADDLE_WITH_MKLDNN in custom_op (#32903) * [Dy2Stat]BugFix StaticAanlysis with gast.Subscript (#32969) * BugFix StaticAanlysis with gast.Subscript * remove codes
-
- 06 5月, 2021 1 次提交
-
-
由 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.
-
- 09 4月, 2021 2 次提交
-
-
由 Aurelius84 提交于
* fix undefind var in For * fix code style
-
由 Aurelius84 提交于
* support DictCmp and zip grammar * fix code style
-
- 24 3月, 2021 1 次提交
-
-
由 Huihuang Zheng 提交于
Our old `loop_body` function may return single element when `loop_vars` just contains only 1 element, which can cause bug. The key point of this PR is forcing `loop_body` functions always return tuple.
-
- 11 3月, 2021 1 次提交
-
-
由 Aurelius84 提交于
* Fix bug with static_convert_var_shape * replace dot with dash
-
- 04 3月, 2021 3 次提交
-
-
由 liym27 提交于
-
由 Huihuang Zheng 提交于
Fix wrong code comment
-
由 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 ```
-
- 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.
-
- 20 2月, 2021 1 次提交
-
-
由 Huihuang Zheng 提交于
As the title, when slice_node like 1:3 being passed to idx of convert_var_shape, it will cause syntax error because a function cannot take this as argument. This PR fixed it.
-
- 18 2月, 2021 1 次提交
-
-
由 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]
-
- 27 1月, 2021 1 次提交
-
-
由 liym27 提交于
-
- 20 1月, 2021 1 次提交
-
-
由 Aurelius84 提交于
* add paddle. * add unittest
-
- 14 1月, 2021 1 次提交
-
-
由 Chen Weihang 提交于
-
- 11 1月, 2021 2 次提交
-
-
由 Huihuang Zheng 提交于
Add clone method for static Variable so that this interface will be same as dygraph. It fixed some bugs in dy2stat
-
由 XiaoguangHu 提交于
* delete paddle.nn.functional.assign * fix dynamic to static error
-
- 08 1月, 2021 3 次提交
-
-
由 Aurelius84 提交于
* fix tensor shape bug * fix op_num * clean code
-
由 liym27 提交于
-
由 liym27 提交于
1. When x is Variable, call nn.shape(x) only in following cases: 1)The shape of x is used in control flow condition. 2)The dim to be used is negetive 2. When x is Variable, but x.shape or x.shape[idx] doesn't contain negetive value, don't convert to paddle.shape()
-
- 21 12月, 2020 1 次提交
-
-
由 liym27 提交于
[Dy2Stat] Fix bug for loop: a variable is used and created in loop, but used before created (#29769)
-
- 18 12月, 2020 2 次提交
-
-
由 Huihuang Zheng 提交于
Enable jit.save to Save Without Running.
-
由 liym27 提交于
Support to transformfor ele in var stms in which var is a slice of Tensor.
-
- 14 12月, 2020 1 次提交
-
-
由 liym27 提交于
[Dy2Stat] 1. Fix bug of for-range stmts. 2. Support that step value is negative in for-range stmts (#29519) 1. Fix error in _build_cond_stmt of for-range stmts. 2. Support that step value is negative in for-range stmts 3. Fix code because of the diff between Py2 and Py3
-
- 04 12月, 2020 2 次提交
-
-
由 Huihuang Zheng 提交于
Reduce exception type so that if covert_to_static failed, it reports right error message.
-
由 liym27 提交于
[Dy2Stat] Fix bug: Do not use gast.Subscript to replace gast.Name in when transforming for_enumerate_loop (#29310)
-
- 03 12月, 2020 1 次提交
-
-
由 liym27 提交于
[Dy2stat] Add a decorator paddle.jit.not_to_static to support that not to convert a function in Dynamic-to-Static. (#29253) Usage scenarios:A function could have run successfully in static mode, you can use it to decorate a function in the following cases: 1. An unknown error occurs in the dynamic-to-static conversion process of the function; 2. In the internal implementation of the function, it has two branches: dynamic branch and static branch; 3. Users don't want to convert the function in the process of dynamic to static.
-
- 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
-
- 30 11月, 2020 1 次提交
-
-
由 WeiXin 提交于
* Changed a variable name error * Add comments * Move member functions of TranslatedLayer out of function * edit code according to review * Edit input argument of '_run_static_graph' * reset due to Segmentation fault * rename variables when stitching graph * modify code according CI * Add comments to '__i_m_p_l__' * remove blanks befor 'Get...' * edit code according to review * Add a comment to '_execution_method_creator' * Edit a comment to '_execution_method_creator'
-
- 28 11月, 2020 2 次提交
- 27 11月, 2020 1 次提交
-
-
由 liym27 提交于
[Dynamic-to-Static] Support **kwargs as input of the function which is decorated by `jit.save.to_static` (#29098)
-
- 25 11月, 2020 1 次提交
-
-
由 liym27 提交于
* Support pop for dict in dy2stat * Move convert_pop to convert_operators.py and polish convert_pop
-
- 24 11月, 2020 3 次提交
-
-
由 Huihuang Zheng 提交于
Add support for using tuple as tensor.shape (For example: a, b, c, d = x.shape)
-
由 liym27 提交于
[Dynamic-to-Static] Fix bug of convert_logical_and/convert_logical_or: the operands are executed sequentially(#28993) 1) The operands are executed sequentially according to the running logic of Python. 2) If the left hand operand is True(for convert_logical_or)/False(for convert_logical_and), the right hand operand should be executed.
-
由 Huihuang Zheng 提交于
The PR description is long. See details in the PR link.
-
- 19 11月, 2020 3 次提交
-
-
由 liym27 提交于
-
由 liym27 提交于
[Dynamic-to-Static] Fix bug in loop_transformer: loop vars should contain the var from ancestor-for-node (#28735)
-
由 liym27 提交于
[Dynamic-to-Static ErrorMessage] Support dy2stat error message when call jit.save and polish error message (#28713) * Support dy2stat error message when call jit.save; * Polish dy2stat error message: (1) the original dygraph code is marked with (* user code *) ; (2) "In user code:" -> "In transformed code:"
-