From 6550c203fa1f22e1a0dd7679ae935eb2d973ff6a Mon Sep 17 00:00:00 2001 From: zhangchunle Date: Tue, 8 Jun 2021 15:12:01 +0800 Subject: [PATCH] fix too-many-function-args-1 (#33398) --- .../inference/tests/api/full_ILSVRC2012_val_preprocess.py | 4 ++-- python/paddle/fluid/tests/unittests/test_gradient_clip.py | 2 +- python/paddle/fluid/transpiler/collective.py | 7 ++++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/inference/tests/api/full_ILSVRC2012_val_preprocess.py b/paddle/fluid/inference/tests/api/full_ILSVRC2012_val_preprocess.py index ad72a89eca..adb6aa4d75 100644 --- a/paddle/fluid/inference/tests/api/full_ILSVRC2012_val_preprocess.py +++ b/paddle/fluid/inference/tests/api/full_ILSVRC2012_val_preprocess.py @@ -167,8 +167,8 @@ def run_convert(): os.path.getsize(output_file) == FULL_SIZE_BYTES): if os.path.exists(output_file): sys.stderr.write( - "\n\nThe existing binary file is broken. Start to generate new one...\n\n" - ) + "\n\nThe existing binary file[{}] is broken. Start to generate new one...\n\n". + format(output_file)) os.remove(output_file) if retry < try_limit: retry = retry + 1 diff --git a/python/paddle/fluid/tests/unittests/test_gradient_clip.py b/python/paddle/fluid/tests/unittests/test_gradient_clip.py index f258e830b5..14f5d4a41a 100644 --- a/python/paddle/fluid/tests/unittests/test_gradient_clip.py +++ b/python/paddle/fluid/tests/unittests/test_gradient_clip.py @@ -133,7 +133,7 @@ class TestGradientClip(unittest.TestCase): print(val) self.assertFalse(np.isnan(val)) - def backward_and_optimize(cost): + def backward_and_optimize(self, cost): pass diff --git a/python/paddle/fluid/transpiler/collective.py b/python/paddle/fluid/transpiler/collective.py index ef6975c3d2..308a876977 100644 --- a/python/paddle/fluid/transpiler/collective.py +++ b/python/paddle/fluid/transpiler/collective.py @@ -434,9 +434,10 @@ class MultiThread(GradAllReduce): print("total endpoints: ", self.endpoints) print("rank: %d, ring_id: %d" % (self.rank, self.nrings)) for ring_id in range(self.nrings): - self._init_communicator( - self.startup_program, self.current_endpoint, self.endpoints, - self.rank, ring_id, self.wait_port, True) + self._init_communicator(self.startup_program, + self.current_endpoint, self.endpoints, + self.rank, ring_id, self.wait_port) + else: print("begin to _transpile_startup_program for single-node") block = self.startup_program.global_block() -- GitLab