add no_check_list for no_grad_set rule #22571
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
according to reason of no_grad_set relu, add NO_CHECK_LIST for no_grad_set relu in no_grad_set_white_list
如果单测的时候发现某个变量的反向出错了,且把这些变量加到这个no_grad_set 里面,则单测就不会做检查 ,也不会发现此错误。
故为了防止大家乱用 no_grad _set,添加no_grad_set specification规则。在OpTest中添加了相应检测方法,在CI中添加了对本规范白名单的检查。
错误示例:
将所有输入赋值给no_grad_set,这是不可取的。
在python/paddle/fluid/tests/unittests/sequence/test_sequence_conv.py中:
He adds the certain variable to the no_grad_set,when running a test, he finds that the reverse of this variable is wrong, the test will not check and the error will not be found.
In order to avoid the indiscriminate use of the no_grad_set value, the specification that the value of no_grad_set must be None is proposed. The corresponding detections are added to Op tests, and CI will check the white list of this specification
Error example:
That the value of no_grad_set is the all input of OP is not possible
python/paddle/fluid/tests/unittests/sequence/test_sequence_conv.py: