From a5c502ebfee92bb3ce7a91111914651aeeaef4af Mon Sep 17 00:00:00 2001 From: yuchen202 <103028470+yuchen202@users.noreply.github.com> Date: Thu, 12 Oct 2023 23:59:00 +0800 Subject: [PATCH 1/3] 1012 --- pyproject.toml | 1 - python/paddle/base/backward.py | 2 +- python/paddle/base/multiprocess_utils.py | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f50f5a363b2c0..393d46b6f8a5f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -107,7 +107,6 @@ ignore = [ # Temporarily ignored "python/paddle/base/**" = [ "UP030", - "C405", "B019", # Confirmation required "C416", "F821", diff --git a/python/paddle/base/backward.py b/python/paddle/base/backward.py index 3e057dcb12cf7..876db0abc3aa7 100755 --- a/python/paddle/base/backward.py +++ b/python/paddle/base/backward.py @@ -2067,7 +2067,7 @@ def append_backward( # not support double grad in control flow sub-block now. if not is_in_control_flow: if program._appending_grad_times > 1: - input_grad_names_set = set([_append_grad_suffix_(loss.name)]) + input_grad_names_set = {_append_grad_suffix_(loss.name)} # TODO: support _append_backward_ops_with_checkpoints_ in # sub-block (control flow) diff --git a/python/paddle/base/multiprocess_utils.py b/python/paddle/base/multiprocess_utils.py index 8d18db0bb3ea8..dd316ddda5ebd 100644 --- a/python/paddle/base/multiprocess_utils.py +++ b/python/paddle/base/multiprocess_utils.py @@ -73,7 +73,7 @@ def _func_register(function): if not callable(function): raise TypeError("%s is not callable object." % (function)) # check function object whether hash-able - set([function]) + {function} if function not in cls._registered_func_set: atexit.register(_func_exectuor) cls._registered_func_set.add(function) From ceba257f3b0fa200b036430da60191f3352a357b Mon Sep 17 00:00:00 2001 From: Nyakku Shigure Date: Sat, 14 Oct 2023 14:52:50 +0800 Subject: [PATCH 2/3] Update python/paddle/base/multiprocess_utils.py Co-authored-by: gouzil <66515297+gouzil@users.noreply.github.com> --- python/paddle/base/multiprocess_utils.py | 1 - 1 file changed, 1 deletion(-) diff --git a/python/paddle/base/multiprocess_utils.py b/python/paddle/base/multiprocess_utils.py index dd316ddda5ebd..9b70cacd1c2cd 100644 --- a/python/paddle/base/multiprocess_utils.py +++ b/python/paddle/base/multiprocess_utils.py @@ -73,7 +73,6 @@ def _func_register(function): if not callable(function): raise TypeError("%s is not callable object." % (function)) # check function object whether hash-able - {function} if function not in cls._registered_func_set: atexit.register(_func_exectuor) cls._registered_func_set.add(function) From 6774b40a994c66c5060a811f2572e100aedf43c8 Mon Sep 17 00:00:00 2001 From: SigureMo Date: Sat, 14 Oct 2023 19:15:18 +0800 Subject: [PATCH 3/3] clean a duplicate `if` --- python/paddle/base/dygraph/base.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/python/paddle/base/dygraph/base.py b/python/paddle/base/dygraph/base.py index 43f8700656e35..5fad89935d4c7 100644 --- a/python/paddle/base/dygraph/base.py +++ b/python/paddle/base/dygraph/base.py @@ -800,8 +800,6 @@ def check_in_out(in_out_list, name): no_grad_vars = [] elif isinstance(no_grad_vars, core.eager.Tensor): no_grad_vars = [no_grad_vars] - elif isinstance(no_grad_vars, core.eager.Tensor): - no_grad_vars = [no_grad_vars] elif isinstance(no_grad_vars, (list, tuple, set)): no_grad_vars = list(no_grad_vars) for var in no_grad_vars: