diff --git a/python/paddle/fluid/tests/unittests/op_test.py b/python/paddle/fluid/tests/unittests/op_test.py index 6b8622b6f26f6102e5ee02716f30a847ed9a2fed..6079de951fcad9965bf4673d28b43a964ec84cc5 100644 --- a/python/paddle/fluid/tests/unittests/op_test.py +++ b/python/paddle/fluid/tests/unittests/op_test.py @@ -371,6 +371,20 @@ class OpTest(unittest.TestCase): no_check_set=None, equal_nan=False, check_dygraph=False): + self._check_output_with_place(place, atol, no_check_set, equal_nan, + check_dygraph) + if self._is_gc_test_enabled(): + self._enable_gc(True) + self._check_output_with_place(place, atol, no_check_set, equal_nan, + check_dygraph) + self._enable_gc(False) + + def _check_output_with_place(self, + place, + atol, + no_check_set=None, + equal_nan=False, + check_dygraph=False): if check_dygraph: dygraph_outs = self._calc_dygraph_output( place, no_check_set=no_check_set) @@ -492,6 +506,19 @@ class OpTest(unittest.TestCase): places.append(core.CUDAPlace(0)) return places + def _is_gc_test_enabled(self): + if hasattr(self, "test_gc") and self.test_gc: + # FIXME(zjl): if ngraph is enabled, some ops would be fused in Executor + # This may cause error of gc. Disable unittests of gc when FLAGS_use_ngraph is True + is_ngraph_enabled = bool(os.environ.get('FLAGS_use_ngraph', False)) + return False if is_ngraph_enabled else True + else: + return False + + def _enable_gc(self, enabled): + threshold = 0.0 if enabled else -1.0 + fluid.core._set_eager_deletion_mode(threshold, 1.0, True) + def check_output(self, atol=1e-5, no_check_set=None, @@ -503,6 +530,13 @@ class OpTest(unittest.TestCase): check_dygraph) def check_output_customized(self, checker): + self._check_output_customized(checker) + if self._is_gc_test_enabled(): + self._enable_gc(True) + self._check_output_customized(checker) + self._enable_gc(False) + + def _check_output_customized(self, checker): places = self._get_places() for place in places: outs = self.calc_output(place) @@ -553,6 +587,26 @@ class OpTest(unittest.TestCase): in_place=False, max_relative_error=0.005, user_defined_grads=None): + self._check_grad_with_place(place, inputs_to_check, output_names, + no_grad_set, numeric_grad_delta, in_place, + max_relative_error, user_defined_grads) + if self._is_gc_test_enabled(): + self._enable_gc(True) + self._check_grad_with_place(place, inputs_to_check, output_names, + no_grad_set, numeric_grad_delta, + in_place, max_relative_error, + user_defined_grads) + self._enable_gc(False) + + def _check_grad_with_place(self, + place, + inputs_to_check, + output_names, + no_grad_set=None, + numeric_grad_delta=0.005, + in_place=False, + max_relative_error=0.005, + user_defined_grads=None): self.scope = core.Scope() op_inputs = self.inputs if hasattr(self, "inputs") else dict() op_outputs = self.outputs if hasattr(self, "outputs") else dict() diff --git a/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py b/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py index 963a17e7d697512e871a97ef24cb1c4ba37a7547..4dab62edee7890262c2426af868de2fbd5db1f39 100644 --- a/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py +++ b/python/paddle/fluid/tests/unittests/test_bilinear_interp_op.py @@ -85,6 +85,7 @@ def bilinear_interp_np(input, class TestBilinearInterpOp(OpTest): def setUp(self): + self.test_gc = True self.out_size = None self.actual_shape = None self.init_test_case() @@ -217,6 +218,7 @@ class TestBilinearInterpActualShape(TestBilinearInterpOp): class TestBilinearInterpOpUint8(OpTest): def setUp(self): + self.test_gc = True self.out_size = None self.actual_shape = None self.init_test_case() diff --git a/python/paddle/fluid/tests/unittests/test_concat_op.py b/python/paddle/fluid/tests/unittests/test_concat_op.py index 436ab7d49f4cafcd30366ae57c40d49e6f7d614f..44f3074dee1435759034c11b1849cec3b8d4e606 100644 --- a/python/paddle/fluid/tests/unittests/test_concat_op.py +++ b/python/paddle/fluid/tests/unittests/test_concat_op.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestConcatOp(OpTest): def setUp(self): + self.test_gc = True self.op_type = "concat" self.init_test_data() self.inputs = {'X': [('x0', self.x0), ('x1', self.x1), ('x2', self.x2)]} diff --git a/python/paddle/fluid/tests/unittests/test_eager_deletion_no_need_buffer_vars_inference.py b/python/paddle/fluid/tests/unittests/test_eager_deletion_no_need_buffer_vars_inference.py deleted file mode 100644 index 3fd582e4d5cb7cec1db0719160a4a795a30e54f1..0000000000000000000000000000000000000000 --- a/python/paddle/fluid/tests/unittests/test_eager_deletion_no_need_buffer_vars_inference.py +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import unittest -import paddle.fluid as fluid -import importlib - -fluid.core._set_eager_deletion_mode(0.0, 1.0, True) - -from test_bilinear_interp_op import * -from test_concat_op import * -from test_elementwise_add_op import * -from test_elementwise_sub_op import * -from test_fill_constant_batch_size_like_op import * -from test_fill_zeros_like2_op import * -from test_gather_op import * -from test_gaussian_random_batch_size_like_op import * -from test_linear_chain_crf_op import * -from test_lod_reset_op import * -from test_lookup_table_op import * -from test_mean_op import * -from test_nearest_interp_op import * -from test_pad2d_op import * -from test_scatter_op import * -from test_sequence_concat import * -from test_seq_conv import * -from test_seq_pool import * -from test_sequence_expand_as import * -from test_sequence_expand import * -from test_sequence_pad_op import * -from test_sequence_unpad_op import * -from test_sequence_scatter_op import * -from test_sequence_slice_op import * -from test_slice_op import * -from test_space_to_depth_op import * -from test_squared_l2_distance_op import * -from test_uniform_random_batch_size_like_op import * - -if __name__ == '__main__': - unittest.main() diff --git a/python/paddle/fluid/tests/unittests/test_elementwise_add_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_add_op.py index 5aec5d8e38aba39e6aba9a8f19637587c2f12544..5d85a2d9eed363848a611cebbf427e38723f881b 100644 --- a/python/paddle/fluid/tests/unittests/test_elementwise_add_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_add_op.py @@ -24,6 +24,7 @@ class TestElementwiseAddOp(OpTest): self.use_mkldnn = False def setUp(self): + self.test_gc = True self.op_type = "elementwise_add" self.dtype = np.float32 self.axis = -1 diff --git a/python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py b/python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py index 6cb88a8bb1cad7a58ca175cfc14298c959e3bad6..a3dc42667ab0d85c4db4c3bc9dd0a1a67a665cca 100644 --- a/python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py +++ b/python/paddle/fluid/tests/unittests/test_elementwise_sub_op.py @@ -20,6 +20,7 @@ from op_test import OpTest class TestElementwiseOp(OpTest): def setUp(self): + self.test_gc = True self.op_type = "elementwise_sub" self.inputs = { 'X': np.random.uniform(0.1, 1, [2, 3]).astype("float32"), diff --git a/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py b/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py index fdc8a118e56f4473da5ed60169daebec14c7c33c..37a4a72895276524103123fd1186117210afbf44 100644 --- a/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_constant_batch_size_like_op.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestFillConstantBatchSizeLikeWhenFirstDimIsBatchSize(OpTest): def setUp(self): + self.test_gc = True self.op_type = "fill_constant_batch_size_like" self.inputs = {'Input': np.random.random((219, 232)).astype("float32")} self.attrs = {'value': 3.5, 'shape': [-1, 132, 7]} @@ -35,6 +36,7 @@ class TestFillConstantBatchSizeLikeWhenFirstDimIsBatchSize(OpTest): class TestFillConstantBatchSizeLikeWhenSecondDimIsBatchSize(OpTest): def setUp(self): + self.test_gc = True self.op_type = "fill_constant_batch_size_like" self.inputs = {'Input': np.random.random((219, 232)).astype("float32")} self.attrs = { @@ -54,6 +56,7 @@ class TestFillConstantBatchSizeLikeWhenSecondDimIsBatchSize(OpTest): class TestFillConstantBatchSizeLikeWithLoDTensor(OpTest): def setUp(self): + self.test_gc = True self.op_type = "fill_constant_batch_size_like" self.inputs = { 'Input': (np.random.random((31, 28)).astype("float32"), diff --git a/python/paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py b/python/paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py index 935653b07a6a4e1d344e8040fa4a0ed72b9b164d..e1f11a15b01f3ea9dae73cdaaf2a7e2a0fd9f6c1 100644 --- a/python/paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py +++ b/python/paddle/fluid/tests/unittests/test_fill_zeros_like2_op.py @@ -22,6 +22,7 @@ from op_test import OpTest class TestFillZerosLike2Op(OpTest): def setUp(self): + self.test_gc = True self.op_type = "fill_zeros_like2" self.dtype = np.float32 self.init_dtype() diff --git a/python/paddle/fluid/tests/unittests/test_gather_op.py b/python/paddle/fluid/tests/unittests/test_gather_op.py index bd5785aa55af241fe42a1ae2c550dbdb980f42e2..aa068459ae30465538cf5d0275025fa33b8c6a9f 100644 --- a/python/paddle/fluid/tests/unittests/test_gather_op.py +++ b/python/paddle/fluid/tests/unittests/test_gather_op.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestGatherOp(OpTest): def setUp(self): + self.test_gc = True self.op_type = "gather" self.config() xnp = np.random.random(self.x_shape).astype("float32") diff --git a/python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py b/python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py index 9a0631fa26a3e93c5c2115fd03a37de3fac46ce5..6f760c5a1a5a2b7fd7bd0dccaf057a65ec401e85 100644 --- a/python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py +++ b/python/paddle/fluid/tests/unittests/test_gaussian_random_batch_size_like_op.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestGaussianRandomBatchSizeLike(OpTest): def setUp(self): + self.test_gc = True self.op_type = "gaussian_random_batch_size_like" self.inputs = {'Input': np.zeros((500, 2000), dtype="float32")} self.attrs = {'mean': 1., 'std': 2., 'shape': [-1, 2000]} diff --git a/python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py b/python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py index b365e1642ef62ecb7a3b8f1b30c9c8fbb5755440..ef8433cef7079c3627cdf52d79658bc5581ad29d 100644 --- a/python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py +++ b/python/paddle/fluid/tests/unittests/test_linear_chain_crf_op.py @@ -143,6 +143,7 @@ class TestLinearChainCrfOp(OpTest): } def setUp(self): + self.test_gc = True self.op_type = "linear_chain_crf" self.set_test_data() diff --git a/python/paddle/fluid/tests/unittests/test_lod_reset_op.py b/python/paddle/fluid/tests/unittests/test_lod_reset_op.py index 31f364a42f624c8662a5ae087b003ca0304ae419..74c407156f3a9e3c23eb499e43e3c46604195d5f 100644 --- a/python/paddle/fluid/tests/unittests/test_lod_reset_op.py +++ b/python/paddle/fluid/tests/unittests/test_lod_reset_op.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestLodResetOpByAttr(OpTest): def setUp(self): + self.test_gc = True self.op_type = "lod_reset" x = np.random.random((10, 20)).astype("float32") lod = [[3, 2, 5]] @@ -42,6 +43,7 @@ class TestLodResetOpByAttr(OpTest): class TestLodResetOpByInput(OpTest): def setUp(self): + self.test_gc = True self.op_type = "lod_reset" x = np.random.random((10, 20)).astype("float32") lod = [[3, 2, 5]] @@ -64,6 +66,7 @@ class TestLodResetOpByInput(OpTest): class TestLodResetOpBoth(OpTest): def setUp(self): + self.test_gc = True self.op_type = "lod_reset" x = np.random.random((10, 20)).astype("float32") lod = [[3, 2, 5]] @@ -86,6 +89,7 @@ class TestLodResetOpBoth(OpTest): class TestLodResetOpYIsLoDTensor(OpTest): def setUp(self): + self.test_gc = True self.op_type = "lod_reset" x = np.random.random((10, 20)).astype("float32") lod = [[3, 2, 5]] diff --git a/python/paddle/fluid/tests/unittests/test_lookup_table_op.py b/python/paddle/fluid/tests/unittests/test_lookup_table_op.py index 4990ee898d81089735f6db4ee4ad6758944e311a..388afe58227ad4b5ff67c3fc45c38112c1653f42 100644 --- a/python/paddle/fluid/tests/unittests/test_lookup_table_op.py +++ b/python/paddle/fluid/tests/unittests/test_lookup_table_op.py @@ -24,6 +24,7 @@ import paddle.compat as cpt class TestLookupTableOp(OpTest): def setUp(self): + self.test_gc = True self.op_type = "lookup_table" table = np.random.random((17, 31)).astype("float32") ids = np.random.randint(0, 17, 4).astype("int64") @@ -40,6 +41,7 @@ class TestLookupTableOp(OpTest): class TestLookupTableOpWithTensorIds(OpTest): def setUp(self): + self.test_gc = True self.op_type = "lookup_table" table = np.random.random((17, 31)).astype("float32") ids = np.random.randint( diff --git a/python/paddle/fluid/tests/unittests/test_mean_op.py b/python/paddle/fluid/tests/unittests/test_mean_op.py index beae909e9b4c88eb7ddfbbe4e5ad2cf583a953ef..fb53235166ae21f8272183a83b45190103cae1f7 100644 --- a/python/paddle/fluid/tests/unittests/test_mean_op.py +++ b/python/paddle/fluid/tests/unittests/test_mean_op.py @@ -22,6 +22,7 @@ import paddle.fluid.core as core class TestMeanOp(OpTest): def setUp(self): + self.test_gc = True self.op_type = "mean" self.dtype = np.float32 self.init_dtype_type() diff --git a/python/paddle/fluid/tests/unittests/test_nearest_interp_op.py b/python/paddle/fluid/tests/unittests/test_nearest_interp_op.py index eb82af75e4a2bf834c010aede79d50b0d73c98bc..62cfc08d15f9ada041f3e3e193340f7cd9375956 100644 --- a/python/paddle/fluid/tests/unittests/test_nearest_interp_op.py +++ b/python/paddle/fluid/tests/unittests/test_nearest_interp_op.py @@ -67,6 +67,7 @@ def nearest_neighbor_interp_np(X, class TestNearestInterpOp(OpTest): def setUp(self): + self.test_gc = True self.out_size = None self.actual_shape = None self.init_test_case() @@ -189,6 +190,7 @@ class TestNearestNeighborInterpActualShape(TestNearestInterpOp): class TestNearestInterpOpUint8(OpTest): def setUp(self): + self.test_gc = True self.out_size = None self.actual_shape = None self.init_test_case() diff --git a/python/paddle/fluid/tests/unittests/test_pad2d_op.py b/python/paddle/fluid/tests/unittests/test_pad2d_op.py index 5c4a6ca59e53d0edafda87eae19516a80ec32c40..85e589a4ab4add2a3ef31ff861233e6989116732 100644 --- a/python/paddle/fluid/tests/unittests/test_pad2d_op.py +++ b/python/paddle/fluid/tests/unittests/test_pad2d_op.py @@ -19,6 +19,7 @@ from op_test import OpTest class TestPad2dOp(OpTest): def setUp(self): + self.test_gc = True self.pad_value = 0.0 self.variable_paddings = False self.initTestCase() diff --git a/python/paddle/fluid/tests/unittests/test_scatter_op.py b/python/paddle/fluid/tests/unittests/test_scatter_op.py index 088996f9d7dee1ea914e36e3342c9a5110001c44..3f4edbbb13b587365f0442db04a76a69f65f8575 100644 --- a/python/paddle/fluid/tests/unittests/test_scatter_op.py +++ b/python/paddle/fluid/tests/unittests/test_scatter_op.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestScatterOp(OpTest): def setUp(self): + self.test_gc = True self.op_type = "scatter" ref_np = np.ones((3, 3)).astype("float32") index_np = np.array([1, 2]).astype("int32") diff --git a/python/paddle/fluid/tests/unittests/test_seq_conv.py b/python/paddle/fluid/tests/unittests/test_seq_conv.py index da111f9b73489b72688bba3841c858ef4e9689d7..d0c69abd701e08fd2a1fa22a303f855475e26114 100644 --- a/python/paddle/fluid/tests/unittests/test_seq_conv.py +++ b/python/paddle/fluid/tests/unittests/test_seq_conv.py @@ -69,6 +69,7 @@ def seqconv(x, class TestSeqProject(OpTest): def setUp(self): + self.test_gc = True self.init_test_case() self.op_type = 'sequence_conv' diff --git a/python/paddle/fluid/tests/unittests/test_seq_pool.py b/python/paddle/fluid/tests/unittests/test_seq_pool.py index 176265428c83c7758eabf86b5b703363b6ee3919..e84aefb582d8838b4a9716e9cab73544c1ca4dac 100644 --- a/python/paddle/fluid/tests/unittests/test_seq_pool.py +++ b/python/paddle/fluid/tests/unittests/test_seq_pool.py @@ -56,6 +56,7 @@ class TestSeqAvgPool(OpTest): compute_seqpool_avg(x, offset, out) def setUp(self): + self.test_gc = True x, offset, out = self.set_data() self.compute(x, offset, out) diff --git a/python/paddle/fluid/tests/unittests/test_sequence_concat.py b/python/paddle/fluid/tests/unittests/test_sequence_concat.py index b4a40edc6ac78a4725e1cfed633e59621fa89f58..a5d26a2ca25e97151b8642790e8d9e01ebfbd145 100644 --- a/python/paddle/fluid/tests/unittests/test_sequence_concat.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_concat.py @@ -26,6 +26,7 @@ class TestSequenceConcat(OpTest): self.out_lod = [19, 11] def setUp(self): + self.test_gc = True x1 = np.random.random(size=(10, 80)) x2 = np.random.random(size=(20, 80)) self.setLoD() diff --git a/python/paddle/fluid/tests/unittests/test_sequence_expand.py b/python/paddle/fluid/tests/unittests/test_sequence_expand.py index 1e4d1119789533eb020f102bb1b08f00311ceae1..fd1cd5a4bd2e7e56a32aa99e17469ee228bbc0a3 100644 --- a/python/paddle/fluid/tests/unittests/test_sequence_expand.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_expand.py @@ -67,6 +67,7 @@ class TestSequenceExpand(OpTest): self.outputs = {'Out': (out, out_lod)} def setUp(self): + self.test_gc = True self.op_type = 'sequence_expand' self.set_data() self.compute() diff --git a/python/paddle/fluid/tests/unittests/test_sequence_expand_as.py b/python/paddle/fluid/tests/unittests/test_sequence_expand_as.py index 30c487eea3dfb2c5d2349a00e62d91a7b7fdc013..7593628dbc02f454ca3baffbdbb8b08ca6541306 100644 --- a/python/paddle/fluid/tests/unittests/test_sequence_expand_as.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_expand_as.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestSequenceExpandAs(OpTest): def setUp(self): + self.test_gc = True self.op_type = 'sequence_expand_as' self.set_data() self.compute() diff --git a/python/paddle/fluid/tests/unittests/test_sequence_pad_op.py b/python/paddle/fluid/tests/unittests/test_sequence_pad_op.py index d5ab9e89fc22147de26c8eb3c505aee0e1203350..75ed45b5c79bd56d0874027aba65c178c92d610b 100644 --- a/python/paddle/fluid/tests/unittests/test_sequence_pad_op.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_pad_op.py @@ -66,6 +66,7 @@ class TestSequencePadOp(OpTest): self.outputs = {'Out': out_data, 'Length': length} def setUp(self): + self.test_gc = True self.op_type = 'sequence_pad' self.set_attr() self.set_data() diff --git a/python/paddle/fluid/tests/unittests/test_sequence_scatter_op.py b/python/paddle/fluid/tests/unittests/test_sequence_scatter_op.py index 4ffe2c2a12bc12eaa4f6ddb860f977de1265cb54..209e3d3488424a5f434ee90806e35924d0a0522c 100644 --- a/python/paddle/fluid/tests/unittests/test_sequence_scatter_op.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_scatter_op.py @@ -22,6 +22,7 @@ class TestSequenceScatterOp(OpTest): return [[3, 5, 4]] def setUp(self): + self.test_gc = True self.op_type = "sequence_scatter" X_data = np.random.uniform(0.1, 1.0, [3, 6]).astype('float32') diff --git a/python/paddle/fluid/tests/unittests/test_sequence_slice_op.py b/python/paddle/fluid/tests/unittests/test_sequence_slice_op.py index 9c5492b5b15c1ddbe61e5840b5075ba1c010f0d8..1c384e0eb7c8731af7b3402603edea4e2ae25ffa 100644 --- a/python/paddle/fluid/tests/unittests/test_sequence_slice_op.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_slice_op.py @@ -49,6 +49,7 @@ class TestSequenceSliceOp(OpTest): self.length = [[10], [8], [6], [4], [2]] def setUp(self): + self.test_gc = True self.op_type = "sequence_slice" self.set_data() diff --git a/python/paddle/fluid/tests/unittests/test_sequence_unpad_op.py b/python/paddle/fluid/tests/unittests/test_sequence_unpad_op.py index 0e65108c717d55e89de2789401c51a2c61ad1240..628d468aa130348bd4c01da8d620ced7fa36539e 100644 --- a/python/paddle/fluid/tests/unittests/test_sequence_unpad_op.py +++ b/python/paddle/fluid/tests/unittests/test_sequence_unpad_op.py @@ -46,6 +46,7 @@ class TestSequenceUnpadOp(OpTest): self.outputs = {'Out': (out.reshape(out_shape), out_lod)} def setUp(self): + self.test_gc = True self.op_type = 'sequence_unpad' self.init() self.compute() diff --git a/python/paddle/fluid/tests/unittests/test_slice_op.py b/python/paddle/fluid/tests/unittests/test_slice_op.py index aefd8cb6d3ad0fbad70dac7492abecf02b526d95..5b3c513fb2467b6cf9dd2758ef4738b8ea75aaf2 100644 --- a/python/paddle/fluid/tests/unittests/test_slice_op.py +++ b/python/paddle/fluid/tests/unittests/test_slice_op.py @@ -22,6 +22,7 @@ from op_test import OpTest class TestSliceOp(OpTest): def setUp(self): + self.test_gc = True self.op_type = "slice" self.config() self.inputs = {'Input': self.input} diff --git a/python/paddle/fluid/tests/unittests/test_space_to_depth_op.py b/python/paddle/fluid/tests/unittests/test_space_to_depth_op.py index 5fdad44f1242b9ee99040b43d7ce2cf84664eed1..ad4c4975c1ce28632c48593fca64b8cd3df645b0 100644 --- a/python/paddle/fluid/tests/unittests/test_space_to_depth_op.py +++ b/python/paddle/fluid/tests/unittests/test_space_to_depth_op.py @@ -41,6 +41,7 @@ class TestSpaceToDepthOp(OpTest): out_[in_index] = in_[out_index] def setUp(self): + self.test_gc = True self.init_data() self.op_type = "space_to_depth" diff --git a/python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py b/python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py index a8bc1004d9bbe91e323db49c0cf0b576f8da306e..423e68020df6888664a5eca00d8e122e426cfb08 100644 --- a/python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py +++ b/python/paddle/fluid/tests/unittests/test_squared_l2_distance_op.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestSquaredL2DistanceOp_f0(OpTest): def setUp(self): + self.test_gc = True self.op_type = "squared_l2_distance" self.inputs = { 'X': np.random.uniform(0.1, 0.6, (2, 3)).astype("float32"), @@ -42,6 +43,7 @@ class TestSquaredL2DistanceOp_f0(OpTest): class TestSquaredL2DistanceOp_f1(OpTest): def setUp(self): + self.test_gc = True self.op_type = "squared_l2_distance" self.inputs = { 'X': np.random.uniform(0.1, 0.6, (2, 3)).astype("float32"), @@ -63,6 +65,7 @@ class TestSquaredL2DistanceOp_f1(OpTest): class TestSquaredL2DistanceOp_f2(OpTest): def setUp(self): + self.test_gc = True self.op_type = "squared_l2_distance" self.inputs = { 'X': np.random.uniform(0.1, 0.6, (2, 3, 4)).astype("float32"), diff --git a/python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py b/python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py index 7b8be24d9da8c15eeb52c0ba207ea780b03254f8..276270006865c434e01089845b2de6b858400cd7 100644 --- a/python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py +++ b/python/paddle/fluid/tests/unittests/test_uniform_random_batch_size_like_op.py @@ -21,6 +21,7 @@ from op_test import OpTest class TestUniformRandomBatchSizeLike(OpTest): def setUp(self): + self.test_gc = True self.op_type = "uniform_random_batch_size_like" self.inputs = {'Input': np.zeros((500, 2000), dtype="float32")} self.attrs = {'min': 1., 'max': 2., 'shape': [-1, 2000]}