From 95c659f0158f7485f9c9afce7a5e72edff718778 Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Mon, 19 Sep 2022 11:36:36 +0800 Subject: [PATCH] [CodeStyle] trim trailing whitespace in yaml and hook (#46080) * [CodeStyle] trim trailing whitespace in yaml and hook * python incremental whitespace and yml files --- .github/ISSUE_TEMPLATE/1_bug-report.yml | 20 ++++++------ .github/ISSUE_TEMPLATE/2_feature-request.yml | 8 ++--- .../3_build-installation-issue.yml | 32 +++++++++---------- .../ISSUE_TEMPLATE/4_documentation-issue.yml | 7 ++-- .github/ISSUE_TEMPLATE/5_ask-a-question.yml | 20 ++++++------ .github/ISSUE_TEMPLATE/6_others.yml | 7 ++-- paddle/phi/api/yaml/backward.yaml | 2 +- python/paddle/autograd/saved_tensors_hooks.py | 6 ++-- .../distributed/auto_parallel/process_mesh.py | 6 ++-- .../unittests/ps/cpu_async_ps_config.yaml | 4 +-- .../tests/unittests/ps/cpu_geo_ps_config.yaml | 4 +-- .../unittests/ps/cpu_sync_ps_config.yaml | 4 +-- .../unittests/ps/fl_async_ps_config.yaml | 4 +-- .../tests/unittests/ps/gpu_ps_config.yaml | 4 +-- .../tests/unittests/ps/heter_ps_config.yaml | 4 +-- tools/codestyle/clang_format.hook | 4 +-- tools/codestyle/cpplint_pre_commit.hook | 4 +-- 17 files changed, 62 insertions(+), 78 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/1_bug-report.yml b/.github/ISSUE_TEMPLATE/1_bug-report.yml index 058589232f..ce433c0908 100644 --- a/.github/ISSUE_TEMPLATE/1_bug-report.yml +++ b/.github/ISSUE_TEMPLATE/1_bug-report.yml @@ -8,14 +8,14 @@ body: attributes: value: > #### 在向Paddle报bug之前,请先查询[历史issue](https://github.com/PaddlePaddle/Paddle/issues)是否报过同样的bug。 - + #### Before submitting a bug, please make sure the issue hasn't been already addressed by searching through [the existing and past issues](https://github.com/PaddlePaddle/Paddle/issues). - type: textarea id: code attributes: - label: bug描述 Describe the Bug - description: | + label: bug描述 Describe the Bug + description: | 请清晰简洁的描述这个bug,最好附上bug复现环境、bug复现步骤及最小代码集,以便我们可以通过运行代码来重现错误。代码片段需要尽可能简洁,请花些时间去掉不相关的代码以帮助我们有效地调试。我们希望通过复制代码并运行得到与你相同的结果,请避免任何外部数据或包含相关的导入等。例如: ```python # 导入所有必要的库。 All necessary imports at the beginning. @@ -27,16 +27,16 @@ body: b = paddle.rand(shape=[1,4]) a.stop_gradient = False b.stop_gradient = False - + c = paddle.zeros((4, 4)) c[0, :] = a/b - + print('Is c requires grad: ', not c.stop_gradient) # 注意:这里出现了bug,期望requires_grad=True ``` 如果代码太长,请将可执行代码放到[AIStudio](https://aistudio.baidu.com/aistudio/index)中并将项目设置为公开(或者放到github gist上),请在项目中描述清楚bug复现步骤,在issue中描述期望结果与实际结果。 如果你报告的是一个报错信息,请将完整回溯的报错贴在这里,并使用 ` ```三引号块``` `展示错误信息。 - - + + placeholder: | 请清晰简洁的描述这个bug。A clear and concise description of what the bug is. @@ -48,8 +48,8 @@ body: 带有完整回溯的报错信息。 The error message you got, with the full traceback. ``` validations: - required: true - + required: true + - type: textarea id: others attributes: @@ -59,7 +59,7 @@ body: If you have anything else to add, please write it here. validations: required: false - + - type: markdown attributes: value: > diff --git a/.github/ISSUE_TEMPLATE/2_feature-request.yml b/.github/ISSUE_TEMPLATE/2_feature-request.yml index e9dd3465d1..bbf905271d 100644 --- a/.github/ISSUE_TEMPLATE/2_feature-request.yml +++ b/.github/ISSUE_TEMPLATE/2_feature-request.yml @@ -7,9 +7,9 @@ body: attributes: value: > #### 你可以在这里提出你对Paddle框架的新需求,包括但不限于:功能或模型缺失、功能不全或无法使用、精度/性能不符合预期等。 - + #### You could submit a request for a new Paddle feature here, including but not limited to: new features or models, incomplete or unusable features, accuracy/performance not as expected, etc. - + - type: textarea id: description attributes: @@ -20,7 +20,7 @@ body: value: "任务目标(请描述你正在做的项目是什么,如模型、论文、项目是什么?);
需求场景(请描述你的项目中为什么需要用此功能);
功能描述(请简单描述或设计这个功能)" validations: required: true - + - type: textarea id: alternatives attributes: @@ -30,7 +30,7 @@ body: A description of any alternative solutions or features you've considered, if any. validations: required: false - + - type: markdown attributes: value: > diff --git a/.github/ISSUE_TEMPLATE/3_build-installation-issue.yml b/.github/ISSUE_TEMPLATE/3_build-installation-issue.yml index 2786175af6..bb48906e5e 100644 --- a/.github/ISSUE_TEMPLATE/3_build-installation-issue.yml +++ b/.github/ISSUE_TEMPLATE/3_build-installation-issue.yml @@ -7,8 +7,8 @@ body: attributes: value: > #### 安装请参考[官网文档](https://www.paddlepaddle.org.cn/install/quick?docurl=/documentation/docs/zh/develop/install/pip/linux-pip.html),若未能解决你的问题,你可以在这里提issue。 - - #### Before submitting a Build/Installation Issue, please make sure you have visited the [official website](https://www.paddlepaddle.org.cn/documentation/docs/en/install/index_en.html). + + #### Before submitting a Build/Installation Issue, please make sure you have visited the [official website](https://www.paddlepaddle.org.cn/documentation/docs/en/install/index_en.html). - type: textarea id: error @@ -19,7 +19,7 @@ body: Please describe your problem in detail, and synchronously post the error message, key log/code snippet, and reproduction steps, so that we can quickly troubleshoot the problem. validations: required: true - + - type: textarea id: environment attributes: @@ -41,24 +41,24 @@ body: 6. (可选)若安装过程遇到问题,请提供安装方式(pip/conda/docker/源码编译)和相应的安装命令。 7. (可选)若使用paddle过程中,遇到了无法使用gpu相关问题,请在命令行中键入`nvidia-smi`和`nvcc -V`,提供这两个命令输出的截图。 8. (可选)若使用特殊硬件,请单独注明。 - - + + placeholder: | **************************************** - Paddle version: - Paddle With CUDA: - - OS: - Python version: - - CUDA version: - cuDNN version: - Nvidia driver version: + Paddle version: + Paddle With CUDA: + + OS: + Python version: + + CUDA version: + cuDNN version: + Nvidia driver version: **************************************** validations: required: true - - + + - type: markdown attributes: value: > diff --git a/.github/ISSUE_TEMPLATE/4_documentation-issue.yml b/.github/ISSUE_TEMPLATE/4_documentation-issue.yml index 936ed3d92e..0b21c3d325 100644 --- a/.github/ISSUE_TEMPLATE/4_documentation-issue.yml +++ b/.github/ISSUE_TEMPLATE/4_documentation-issue.yml @@ -7,7 +7,7 @@ body: attributes: value: > #### 请确认反馈的问题来自PaddlePaddle官网文档:https://www.paddlepaddle.org.cn/ 。 - + #### Before submitting a Documentation Issue, Please make sure that issue is related to https://www.paddlepaddle.org.cn/. - type: textarea @@ -28,12 +28,11 @@ body: description: | 请告诉我们,你希望如何改进这个文档。或者你可以提个PR修复这个问题。[教程参考](https://github.com/PaddlePaddle/docs/wiki#%E8%B4%A1%E7%8C%AE%E6%96%87%E6%A1%A3) Please tell us how you would like to improve this document. Or you can submit a PR to fix this problem. - + validations: required: false - + - type: markdown attributes: value: > 感谢你的贡献 🎉!Thanks for your contribution 🎉! - diff --git a/.github/ISSUE_TEMPLATE/5_ask-a-question.yml b/.github/ISSUE_TEMPLATE/5_ask-a-question.yml index 158918946f..78a5bf13cf 100644 --- a/.github/ISSUE_TEMPLATE/5_ask-a-question.yml +++ b/.github/ISSUE_TEMPLATE/5_ask-a-question.yml @@ -7,23 +7,23 @@ body: attributes: value: > #### 你可以在这里提出一个使用/咨询问题,提问之前请确保: - + - 1)已经百度/谷歌搜索过你的问题,但是没有找到解答; - + - 2)已经在官网查询过[API文档](https://www.paddlepaddle.org.cn/documentation/docs/zh/api/index_cn.html)与[FAQ](https://www.paddlepaddle.org.cn/documentation/docs/zh/faq/index_cn.html),但是没有找到解答; - + - 3)已经在[历史issue](https://github.com/PaddlePaddle/Paddle/issues)中搜索过,没有找到同类issue或issue未被解答。 - - + + #### You could ask a usage or consultation question here, before your start, please make sure: - + - 1) You have searched your question on Baidu/Google, but found no answer; - + - 2) You have checked the [API documentation](https://www.paddlepaddle.org.cn/documentation/docs/en/api/index_en.html), but found no answer; - + - 3) You have searched [the existing and past issues](https://github.com/PaddlePaddle/Paddle/issues), but found no similar issue or the issue has not been answered. - - + + - type: textarea id: question diff --git a/.github/ISSUE_TEMPLATE/6_others.yml b/.github/ISSUE_TEMPLATE/6_others.yml index e8f4a9c232..ec2f08ae16 100644 --- a/.github/ISSUE_TEMPLATE/6_others.yml +++ b/.github/ISSUE_TEMPLATE/6_others.yml @@ -7,7 +7,7 @@ body: attributes: value: > #### 你可以在这里提出任何前面几类模板不适用的问题,包括但不限于:优化性建议、框架使用体验反馈、版本兼容性问题、报错信息不清楚等。 - + #### You can report any issues that are not applicable to the previous types of templates, including but not limited to: enhancement suggestions, feedback on the use of the framework, version compatibility issues, unclear error information, etc. - type: textarea @@ -16,11 +16,8 @@ body: label: 问题描述 Please describe your issue validations: required: true - + - type: markdown attributes: value: > 感谢你的贡献 🎉! Thanks for your contribution 🎉! - - - diff --git a/paddle/phi/api/yaml/backward.yaml b/paddle/phi/api/yaml/backward.yaml index 9d81435169..9e37919d7b 100644 --- a/paddle/phi/api/yaml/backward.yaml +++ b/paddle/phi/api/yaml/backward.yaml @@ -114,7 +114,7 @@ param : [out] kernel : func : erfinv_grad - + - backward_op : fft_c2c_grad forward: fft_c2c(Tensor x, int64_t[] axes, str normalization, bool forward) -> Tensor(out) args : (Tensor out_grad, int64_t[] axes, str normalization, bool forward) diff --git a/python/paddle/autograd/saved_tensors_hooks.py b/python/paddle/autograd/saved_tensors_hooks.py index 1e0f292d68..ff5fecf5cc 100644 --- a/python/paddle/autograd/saved_tensors_hooks.py +++ b/python/paddle/autograd/saved_tensors_hooks.py @@ -20,10 +20,10 @@ __all__ = [] 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: diff --git a/python/paddle/distributed/auto_parallel/process_mesh.py b/python/paddle/distributed/auto_parallel/process_mesh.py index 14ce5ea75b..2205484bdb 100644 --- a/python/paddle/distributed/auto_parallel/process_mesh.py +++ b/python/paddle/distributed/auto_parallel/process_mesh.py @@ -41,19 +41,19 @@ def reset_current_process_mesh(): class ProcessMesh(object): """ - The `Processmesh` object describes the topology of the used processes. + The `Processmesh` object describes the topology of the used processes. Args: mesh (list|numpy.array): an n-dimensional array describes the toplogy of the processes. dim_names (list, optional): the i-th element of this list gives the name of the i-th dimension of the mesh. - + Examples: .. code-block:: python import paddle - + mesh = auto.ProcessMesh([[2, 4, 5], [0, 1, 3]], dim_names=["x", "y"]) assert mesh.shape == [2, 3] assert mesh.processe_ids == [2, 4, 5, 0, 1, 3] diff --git a/python/paddle/fluid/tests/unittests/ps/cpu_async_ps_config.yaml b/python/paddle/fluid/tests/unittests/ps/cpu_async_ps_config.yaml index 93a13a67ce..6a843865a6 100755 --- a/python/paddle/fluid/tests/unittests/ps/cpu_async_ps_config.yaml +++ b/python/paddle/fluid/tests/unittests/ps/cpu_async_ps_config.yaml @@ -29,7 +29,5 @@ runner: sync_mode: "async" # sync / async / geo / heter thread_num: 16 use_gpu: 0 - - model_path: "../ps_dnn_model.py" - + model_path: "../ps_dnn_model.py" diff --git a/python/paddle/fluid/tests/unittests/ps/cpu_geo_ps_config.yaml b/python/paddle/fluid/tests/unittests/ps/cpu_geo_ps_config.yaml index 80125ae6c3..f6864cacd6 100644 --- a/python/paddle/fluid/tests/unittests/ps/cpu_geo_ps_config.yaml +++ b/python/paddle/fluid/tests/unittests/ps/cpu_geo_ps_config.yaml @@ -30,7 +30,5 @@ runner: sync_mode: "geo" thread_num: 16 use_gpu: 0 - - model_path: "../ps_dnn_model.py" - + model_path: "../ps_dnn_model.py" diff --git a/python/paddle/fluid/tests/unittests/ps/cpu_sync_ps_config.yaml b/python/paddle/fluid/tests/unittests/ps/cpu_sync_ps_config.yaml index 95685a488c..449856fe12 100644 --- a/python/paddle/fluid/tests/unittests/ps/cpu_sync_ps_config.yaml +++ b/python/paddle/fluid/tests/unittests/ps/cpu_sync_ps_config.yaml @@ -29,7 +29,5 @@ runner: sync_mode: "sync" thread_num: 16 use_gpu: 0 - - model_path: "../ps_dnn_model.py" - + model_path: "../ps_dnn_model.py" diff --git a/python/paddle/fluid/tests/unittests/ps/fl_async_ps_config.yaml b/python/paddle/fluid/tests/unittests/ps/fl_async_ps_config.yaml index 3e02046f71..99f4b9f938 100755 --- a/python/paddle/fluid/tests/unittests/ps/fl_async_ps_config.yaml +++ b/python/paddle/fluid/tests/unittests/ps/fl_async_ps_config.yaml @@ -33,7 +33,5 @@ runner: batch_size: 2 train_files_path: "./train_data" epoch_num: 4 - - model_path: "../ps_dnn_model.py" - + model_path: "../ps_dnn_model.py" diff --git a/python/paddle/fluid/tests/unittests/ps/gpu_ps_config.yaml b/python/paddle/fluid/tests/unittests/ps/gpu_ps_config.yaml index 9a97915e08..aef4c1eb4b 100644 --- a/python/paddle/fluid/tests/unittests/ps/gpu_ps_config.yaml +++ b/python/paddle/fluid/tests/unittests/ps/gpu_ps_config.yaml @@ -31,7 +31,5 @@ runner: sync_mode: "gpubox" thread_num: 16 use_gpu: 1 - - model_path: "../ps_dnn_model.py" - + model_path: "../ps_dnn_model.py" diff --git a/python/paddle/fluid/tests/unittests/ps/heter_ps_config.yaml b/python/paddle/fluid/tests/unittests/ps/heter_ps_config.yaml index d0c48e242d..0cab383a08 100644 --- a/python/paddle/fluid/tests/unittests/ps/heter_ps_config.yaml +++ b/python/paddle/fluid/tests/unittests/ps/heter_ps_config.yaml @@ -30,7 +30,5 @@ runner: thread_num: 8 micro_num: 8 # micro batch num for each thread pipeline: True - - model_path: "../ps_dnn_model.py" - + model_path: "../ps_dnn_model.py" diff --git a/tools/codestyle/clang_format.hook b/tools/codestyle/clang_format.hook index 79a0a542eb..fdc3c054c0 100755 --- a/tools/codestyle/clang_format.hook +++ b/tools/codestyle/clang_format.hook @@ -6,14 +6,14 @@ readonly VERSION="13.0.0" version=$(clang-format -version) if ! [[ $(python -V 2>&1 | awk '{print $2}' | awk -F '.' '{print $1$2}') -ge 36 ]]; then - echo "clang-format installation by pip need python version great equal 3.6, + echo "clang-format installation by pip need python version great equal 3.6, please change the default python to higher version." exit 1 fi if ! [[ $version == *"$VERSION"* ]]; then # low version of pip may not have the source of clang-format whl - pip install --upgrade pip + pip install --upgrade pip pip install clang-format==13.0.0 fi diff --git a/tools/codestyle/cpplint_pre_commit.hook b/tools/codestyle/cpplint_pre_commit.hook index 3c584a440e..fdda83610f 100755 --- a/tools/codestyle/cpplint_pre_commit.hook +++ b/tools/codestyle/cpplint_pre_commit.hook @@ -11,10 +11,10 @@ if [[ ! $TRAVIS_BRANCH ]]; then if ! [[ $version == *"$VERSION"* ]]; then pip install cpplint==1.6.0 fi - # diff files on local machine. + # diff files on local machine. files=$(git diff --cached --name-status | awk '$1 != "D" {print $2}') else - # diff files between PR and latest commit on Travis CI. + # diff files between PR and latest commit on Travis CI. branch_ref=$(git rev-parse "$TRAVIS_BRANCH") head_ref=$(git rev-parse HEAD) files=$(git diff --name-status $branch_ref $head_ref | awk '$1 != "D" {print $2}') -- GitLab