From 4c55502bce0c3c12af9d3b150ec3207acd908fe2 Mon Sep 17 00:00:00 2001 From: lelelelelez Date: Fri, 30 Jul 2021 16:20:01 +0800 Subject: [PATCH] fix function-redefined --- python/paddle/fluid/dataloader/dataloader_iter.py | 10 ---------- .../tests/unittests/dygraph_to_static/test_dict.py | 2 +- .../unittests/mkldnn/test_activation_mkldnn_op.py | 3 --- .../tests/unittests/mkldnn/test_pool2d_mkldnn_op.py | 3 --- .../unittests/sequence/test_sequence_unpad_op.py | 2 +- .../paddle/fluid/tests/unittests/test_argsort_op.py | 2 +- .../tests/unittests/test_bicubic_interp_v2_op.py | 4 ++-- .../paddle/fluid/tests/unittests/test_flatten2_op.py | 2 +- .../paddle/fluid/tests/unittests/test_flatten_op.py | 2 +- .../test_fleet_graph_execution_meta_optimizer.py | 2 +- .../unittests/test_fleet_sharding_meta_optimizer.py | 2 +- .../tests/unittests/test_imperative_auto_prune.py | 12 ------------ python/paddle/fluid/tests/unittests/test_linspace.py | 4 ++-- .../test_parallel_dygraph_pipeline_parallel.py | 2 +- 14 files changed, 12 insertions(+), 40 deletions(-) diff --git a/python/paddle/fluid/dataloader/dataloader_iter.py b/python/paddle/fluid/dataloader/dataloader_iter.py index 4a9b450be9504..069dff28ccf9b 100644 --- a/python/paddle/fluid/dataloader/dataloader_iter.py +++ b/python/paddle/fluid/dataloader/dataloader_iter.py @@ -391,16 +391,6 @@ def _reset(self): for _ in range(self._outstanding_capacity): self._try_put_indices() - def _clear_and_remove_data_queue(self): - if self._data_queue is not None: - while True: - try: - self._data_queue.get_nowait() - except: - self._data_queue.cancel_join_thread() - self._data_queue.close() - break - def _shutdown_worker(self, worker_id, shutdown=False): if self._worker_status[worker_id] or (self._persistent_workers and shutdown): diff --git a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_dict.py b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_dict.py index dbd3952991cfd..a7be885576496 100644 --- a/python/paddle/fluid/tests/unittests/dygraph_to_static/test_dict.py +++ b/python/paddle/fluid/tests/unittests/dygraph_to_static/test_dict.py @@ -219,7 +219,7 @@ def forward(self, x, **kwargs): return x -class TestDictPop(TestNetWithDict): +class TestDictPop3(TestNetWithDict): def setUp(self): self.x = np.array([2, 2]).astype('float32') diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py index e10a7be40d85c..f782c5b710b50 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_activation_mkldnn_op.py @@ -117,9 +117,6 @@ def setUp(self): def init_dtype(self): self.dtype = np.float32 - def init_dtype(self): - self.dtype = np.float32 - class TestMKLDNNHardSwishDim2(TestHardSwish): def setUp(self): diff --git a/python/paddle/fluid/tests/unittests/mkldnn/test_pool2d_mkldnn_op.py b/python/paddle/fluid/tests/unittests/mkldnn/test_pool2d_mkldnn_op.py index 7ecd0ee09985e..3f80bdc1651be 100644 --- a/python/paddle/fluid/tests/unittests/mkldnn/test_pool2d_mkldnn_op.py +++ b/python/paddle/fluid/tests/unittests/mkldnn/test_pool2d_mkldnn_op.py @@ -122,9 +122,6 @@ def init_shape(self): def init_kernel_type(self): self.use_mkldnn = True - def init_global_pool(self): - self.global_pool = False - def init_data_type(self): self.dtype = np.float32 diff --git a/python/paddle/fluid/tests/unittests/sequence/test_sequence_unpad_op.py b/python/paddle/fluid/tests/unittests/sequence/test_sequence_unpad_op.py index aec3033316ba3..1d212296227f7 100644 --- a/python/paddle/fluid/tests/unittests/sequence/test_sequence_unpad_op.py +++ b/python/paddle/fluid/tests/unittests/sequence/test_sequence_unpad_op.py @@ -79,7 +79,7 @@ def init(self): self.dtype = "float64" -class TestSequenceUnpadOp4(TestSequenceUnpadOp): +class TestSequenceUnpadOp5(TestSequenceUnpadOp): def init(self): self.length = [0, 4, 3, 0] self.x_shape = (4, 5, 3, 3, 6) diff --git a/python/paddle/fluid/tests/unittests/test_argsort_op.py b/python/paddle/fluid/tests/unittests/test_argsort_op.py index e324f0ec3d37f..ee2d65684f9ba 100644 --- a/python/paddle/fluid/tests/unittests/test_argsort_op.py +++ b/python/paddle/fluid/tests/unittests/test_argsort_op.py @@ -436,7 +436,7 @@ def init(self): self.axis = 1 -class TestArgsortImperative2(TestArgsortImperative): +class TestArgsortImperative4(TestArgsortImperative): def init(self): self.input_shape = [2, 3, 4] self.axis = 1 diff --git a/python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py b/python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py index 58d8d0f53d07b..a517d25524032 100644 --- a/python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py +++ b/python/paddle/fluid/tests/unittests/test_bicubic_interp_v2_op.py @@ -484,7 +484,7 @@ def test_scale_shape(): align_corners=False, scale_factor=[1, 2, 2]) - def test_scale_value(): + def test_scale_value_1(): x = fluid.data(name="x", shape=[2, 3, 6, 6], dtype="float32") out = interpolate( x, @@ -535,7 +535,7 @@ def test_input_shape(): self.assertRaises(ValueError, test_outshape_and_scale) self.assertRaises(ValueError, test_align_corners_and_nearest) self.assertRaises(ValueError, test_scale_shape) - self.assertRaises(ValueError, test_scale_value) + self.assertRaises(ValueError, test_scale_value_1) self.assertRaises(ValueError, test_size_and_scale) self.assertRaises(ValueError, test_size_and_scale2) self.assertRaises(TypeError, test_size_type) diff --git a/python/paddle/fluid/tests/unittests/test_flatten2_op.py b/python/paddle/fluid/tests/unittests/test_flatten2_op.py index 0d50c65558a91..a3c12a5fc01c3 100644 --- a/python/paddle/fluid/tests/unittests/test_flatten2_op.py +++ b/python/paddle/fluid/tests/unittests/test_flatten2_op.py @@ -46,7 +46,7 @@ def init_attrs(self): self.attrs = {"axis": self.axis} -class TestFlattenOp(TestFlattenOp): +class TestFlattenOp1(TestFlattenOp): def init_test_case(self): self.in_shape = (3, 2, 5, 4) self.axis = 0 diff --git a/python/paddle/fluid/tests/unittests/test_flatten_op.py b/python/paddle/fluid/tests/unittests/test_flatten_op.py index cf568970b7346..a5b24debaee7f 100644 --- a/python/paddle/fluid/tests/unittests/test_flatten_op.py +++ b/python/paddle/fluid/tests/unittests/test_flatten_op.py @@ -43,7 +43,7 @@ def init_attrs(self): self.attrs = {"axis": self.axis} -class TestFlattenOp(TestFlattenOp): +class TestFlattenOp1(TestFlattenOp): def init_test_case(self): self.in_shape = (3, 2, 2, 10) self.axis = 0 diff --git a/python/paddle/fluid/tests/unittests/test_fleet_graph_execution_meta_optimizer.py b/python/paddle/fluid/tests/unittests/test_fleet_graph_execution_meta_optimizer.py index 6c462c435cec2..393de688aa5e0 100644 --- a/python/paddle/fluid/tests/unittests/test_fleet_graph_execution_meta_optimizer.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_graph_execution_meta_optimizer.py @@ -209,7 +209,7 @@ def node_func(): proc_b.start() wait([proc_a, proc_b]) - def test_graph_execution_optimizer(self): + def test_graph_execution_optimizer_v2(self): port_a = self._dist_ut_port_0 + 6 port_b = self._dist_ut_port_1 + 6 node_a = { diff --git a/python/paddle/fluid/tests/unittests/test_fleet_sharding_meta_optimizer.py b/python/paddle/fluid/tests/unittests/test_fleet_sharding_meta_optimizer.py index d66fb2c36b70d..a1cd0df8d7c7e 100755 --- a/python/paddle/fluid/tests/unittests/test_fleet_sharding_meta_optimizer.py +++ b/python/paddle/fluid/tests/unittests/test_fleet_sharding_meta_optimizer.py @@ -292,7 +292,7 @@ def test_sharding_clone_for_test(self): ]) -class TestFleetMetaOptimizer(TestFleetMetaOptimizer): +class TestFleetMetaOptimizer_V1(TestFleetMetaOptimizer): def setUp(self): os.environ["PADDLE_TRAINER_ID"] = "3" os.environ[ diff --git a/python/paddle/fluid/tests/unittests/test_imperative_auto_prune.py b/python/paddle/fluid/tests/unittests/test_imperative_auto_prune.py index 837e82882e9df..b82a058ae4eb1 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_auto_prune.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_auto_prune.py @@ -375,18 +375,6 @@ def test_case2_prune_no_grad_branch(self): self.assertTrue(case3.linear2.weight._grad_ivar() is None) self.assertTrue(case3.linear.weight._grad_ivar() is not None) - def test_case2_prune_no_grad_branch(self): - with fluid.dygraph.guard(): - value1 = np.arange(784).reshape(1, 784) - value2 = np.arange(1).reshape(1, 1) - v1 = fluid.dygraph.to_variable(value1).astype("float32") - v2 = fluid.dygraph.to_variable(value2).astype("float32") - case3 = AutoPruneLayer2(input_size=784) - loss = case3(v1, v2) - loss.backward() - self.assertTrue(case3.linear2.weight._grad_ivar() is None) - self.assertTrue(case3.linear.weight._grad_ivar() is not None) - def test_case3_prune_no_grad_branch2(self): with fluid.dygraph.guard(): value1 = np.arange(1).reshape(1, 1) diff --git a/python/paddle/fluid/tests/unittests/test_linspace.py b/python/paddle/fluid/tests/unittests/test_linspace.py index 03cb84ec99e02..635b3437f70aa 100644 --- a/python/paddle/fluid/tests/unittests/test_linspace.py +++ b/python/paddle/fluid/tests/unittests/test_linspace.py @@ -143,10 +143,10 @@ def test_start_type(): self.assertRaises(TypeError, test_start_type) - def test_end_dtype(): + def test_end_type(): fluid.layers.linspace(0, [10], 1, dtype="float32") - self.assertRaises(TypeError, test_end_dtype) + self.assertRaises(TypeError, test_end_type) def test_step_dtype(): fluid.layers.linspace(0, 10, [0], dtype="float32") diff --git a/python/paddle/fluid/tests/unittests/test_parallel_dygraph_pipeline_parallel.py b/python/paddle/fluid/tests/unittests/test_parallel_dygraph_pipeline_parallel.py index 73967782aea2d..9f534381c98ab 100644 --- a/python/paddle/fluid/tests/unittests/test_parallel_dygraph_pipeline_parallel.py +++ b/python/paddle/fluid/tests/unittests/test_parallel_dygraph_pipeline_parallel.py @@ -27,7 +27,7 @@ def test_hybrid_parallel_pp_layer(self): def test_hybrid_parallel_pp_tuple_inputs(self): self.run_mnist_2gpu('hybrid_parallel_pp_embedding.py') - def test_hybrid_parallel_pp_tuple_inputs(self): + def test_hybrid_parallel_shared_weight(self): self.run_mnist_2gpu('hybrid_parallel_shared_weight.py') def test_pipeline_parallel(self):