Skip to content

It's recommend to set no_grad_set to be None (English Version)

HappyAngel edited this page Feb 13, 2020 · 7 revisions

Specification summary:

  • Section 1, Explanations Of The Specification
  • Section 2, Check Of The Specification
  • Section 3, Check Of CI
  • Section 4, Suggestions Of Check Failure

Supplementary note:

  1. You may find some aspects that are not taken into account in the existing specifications, which need to be continuously supplemented and improved during the implementation process. Please feel free to give your feedback.

1. Explanations Of The Specification

While running a test and adding the certain variable to the no_grad_set, 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.

2. Checks Of The Specification

Op tests requirements:

 - The value of no_grad_set should be None.
 - That the value of no_grad_set is the all input of OP is not advisable

3. Check Of CI

  • The white list of this specification will skip specific OPs with value of no_grad_set and OPs to be repaired. White list path: python/paddle/fluid/tests/unittests/white_list/no_grad_set_white_list.py

  • The whitelist will be checked in CI. If you need to modify it, please contact one of specific people for approval.

  • Error example File_path: python/paddle/fluid/tests/unittests/sequence/test_sequence_conv.py The value of no_grad_set is the all input of sequence_conv(X, Filter), this is not advisable(Detailed Information:PR22571).


    self.inputs = { 'X': (x, self.lod), 'Filter': w, }

    def test_check_grad_padding_data(self): if self.padding_trainable: self.check_grad( ['PaddingData'], 'Out', no_grad_set=set(['X', 'Filter']))


4. Suggestions for Check Failure

  • The value of nno_grad_set must be None
  • If the value of no_grad_set is not None, please contact one of specific people for approval. If it is passing, you can put this op in NO_CHECK_LIST of no_grad_set_white_list to skip no_grad_set check

If you encounter other problems, please contact @chenjiaoAngel

Clone this wiki locally