From a3f47173ebef3524faa50bfb20d9e0c949cade89 Mon Sep 17 00:00:00 2001 From: SigureMo Date: Thu, 15 Sep 2022 16:17:02 +0800 Subject: [PATCH 1/5] adjust pre-commit config --- .pre-commit-config.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a9872771ff65..73bdfd0921869 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,7 @@ +exclude: | + (?x)^( + patches/.+ + )$ repos: - repo: https://github.com/Lucas-C/pre-commit-hooks.git rev: v1.1.14 @@ -26,7 +30,7 @@ repos: - id: sort-simple-yaml files: (api|backward|api_[a-z_]+)\.yaml$ - id: trailing-whitespace - files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists.txt)$ + files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$ - repo: local hooks: - id: clang-format From 2d1e065a2acc81a2cd3bb730fa13280cfffb5030 Mon Sep 17 00:00:00 2001 From: SigureMo Date: Thu, 15 Sep 2022 16:34:05 +0800 Subject: [PATCH 2/5] incremental trailing whitespace --- python/paddle/autograd/saved_tensors_hooks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/paddle/autograd/saved_tensors_hooks.py b/python/paddle/autograd/saved_tensors_hooks.py index 1e0f292d68b49..ff5fecf5ccd5a 100644 --- a/python/paddle/autograd/saved_tensors_hooks.py +++ b/python/paddle/autograd/saved_tensors_hooks.py @@ -20,10 +20,10 @@ class saved_tensors_hooks(): """ Dynamic graph, registers a pair of pack / unpack hooks for saved tensors. - + Parameters: pack_hook (function): The pack hook will be called every time the forward - operation inputs/outputs tensors need be saved for backward. Then you + operation inputs/outputs tensors need be saved for backward. Then you can save it to CPU or Disk. The input of `pack_hook` is a tensor need be saved. The output of `pack_hook` is then stored information instead of the original tensor. `pack_hook` will also be called while any @@ -36,7 +36,7 @@ class saved_tensors_hooks(): the tensor and return it to paddle framework. The input of `unpack_hook` is the information returned by `pack_hook`. The output of `unpack_hook` is a tensor reloaded by the information, and the tensor mast has the same - content as the original tensor passed as input to the corresponding + content as the original tensor passed as input to the corresponding `pack_hook`. Returns: From b2c7ac47a5b28cca3d5a52a1ae02d4bad06b005a Mon Sep 17 00:00:00 2001 From: SigureMo Date: Thu, 15 Sep 2022 17:34:20 +0800 Subject: [PATCH 3/5] revert python increment, fix in #46080 --- python/paddle/autograd/saved_tensors_hooks.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/python/paddle/autograd/saved_tensors_hooks.py b/python/paddle/autograd/saved_tensors_hooks.py index ff5fecf5ccd5a..1e0f292d68b49 100644 --- a/python/paddle/autograd/saved_tensors_hooks.py +++ b/python/paddle/autograd/saved_tensors_hooks.py @@ -20,10 +20,10 @@ class saved_tensors_hooks(): """ Dynamic graph, registers a pair of pack / unpack hooks for saved tensors. - + Parameters: pack_hook (function): The pack hook will be called every time the forward - operation inputs/outputs tensors need be saved for backward. Then you + operation inputs/outputs tensors need be saved for backward. Then you can save it to CPU or Disk. The input of `pack_hook` is a tensor need be saved. The output of `pack_hook` is then stored information instead of the original tensor. `pack_hook` will also be called while any @@ -36,7 +36,7 @@ class saved_tensors_hooks(): the tensor and return it to paddle framework. The input of `unpack_hook` is the information returned by `pack_hook`. The output of `unpack_hook` is a tensor reloaded by the information, and the tensor mast has the same - content as the original tensor passed as input to the corresponding + content as the original tensor passed as input to the corresponding `pack_hook`. Returns: From 818a8e53653b03bad7fded2297ca44bc40316a99 Mon Sep 17 00:00:00 2001 From: SigureMo Date: Thu, 15 Sep 2022 17:36:36 +0800 Subject: [PATCH 4/5] add .yaml and .hook suffix to pre-commit config, test=document_fix --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 73bdfd0921869..4f1787fa2239e 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - id: sort-simple-yaml files: (api|backward|api_[a-z_]+)\.yaml$ - id: trailing-whitespace - files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$ + files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake|yaml|hook)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$ - repo: local hooks: - id: clang-format From cc3e11441a6cbb97e70cdc140cec24930f8489cb Mon Sep 17 00:00:00 2001 From: SigureMo Date: Fri, 16 Sep 2022 22:43:29 +0800 Subject: [PATCH 5/5] add yml suffix --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4f1787fa2239e..0922511b15dd1 100755 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - id: sort-simple-yaml files: (api|backward|api_[a-z_]+)\.yaml$ - id: trailing-whitespace - files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake|yaml|hook)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$ + files: (.*\.(py|bzl|md|rst|c|cc|cxx|cpp|cu|h|hpp|hxx|xpu|kps|cmake|yaml|yml|hook)|BUILD|.*\.BUILD|WORKSPACE|CMakeLists\.txt)$ - repo: local hooks: - id: clang-format