diff --git a/paddle/fluid/operators/controlflow/while_op_helper.cc b/paddle/fluid/operators/controlflow/while_op_helper.cc index 0324a1586a031a16d4c4ef0f7139a24abb4fc42b..848ff5e8f14fc6153efc8a8da07c7c5c6d6518f1 100644 --- a/paddle/fluid/operators/controlflow/while_op_helper.cc +++ b/paddle/fluid/operators/controlflow/while_op_helper.cc @@ -241,9 +241,6 @@ static void PrepareSafeEagerDeletionOnWhileOpAndWhileGradOpImpl( ModifyWhileOpAndWhileGradOpAttr(*matched_fwd_op, bwd_op); while_op_set.erase(*matched_fwd_op); } - - PADDLE_ENFORCE(while_op_set.empty(), - "There are not matched while_grad op in graph."); } void PrepareSafeEagerDeletionOnWhileOpAndWhileGradOp( diff --git a/python/paddle/fluid/tests/unittests/test_eager_deletion_while_op.py b/python/paddle/fluid/tests/unittests/test_eager_deletion_while_op.py index 7fa1636579e33a88beb57bb7a6efa493890f5289..898d04ebe1c9c2c3a336aeca07ab6ce79a890e0a 100644 --- a/python/paddle/fluid/tests/unittests/test_eager_deletion_while_op.py +++ b/python/paddle/fluid/tests/unittests/test_eager_deletion_while_op.py @@ -47,7 +47,7 @@ class TestEagerDeletionWhileOpBase(unittest.TestCase): self.with_data_parallel = with_data_parallel if not core.is_compiled_with_cuda() and isinstance(self.place, - core.CUDPlace): + core.CUDAPlace): return if isinstance(self.place, core.CUDAPlace): @@ -55,8 +55,8 @@ class TestEagerDeletionWhileOpBase(unittest.TestCase): ) if self.with_data_parallel else 1 else: device_cnt = int( - os.environ['CPU_NUM'], - multiprocessing.cpu_count()) if self.with_data_parallel else 1 + os.environ.get('CPU_NUM', multiprocessing.cpu_count( + ))) if self.with_data_parallel else 1 d0 = layers.data( "d0", shape=[10], append_batch_size=False, dtype='float32') diff --git a/python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py b/python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py index d44e4627d8ef8510e5515c73cc329a84fc8ff3fe..ba3b275c7e826cf4faf00630743549ef40736420 100644 --- a/python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py +++ b/python/paddle/fluid/tests/unittests/test_partial_eager_deletion_transformer.py @@ -18,7 +18,7 @@ os.environ['FLAGS_eager_delete_tensor_gb'] = "0.0" os.environ['FLAGS_memory_fraction_of_eager_deletion'] = "0.55" os.environ[ - 'RECORDIO_FILENAME'] = '/tmp/eager_deletion_transformer.wmt16.recordio' + 'RECORDIO_FILENAME'] = '/tmp/partial_eager_deletion_transformer.wmt16.recordio' from test_parallel_executor_transformer import TestTransformer