diff --git a/paddle/fluid/imperative/layer.h b/paddle/fluid/imperative/layer.h index 2dca0b95372a0e40c8674a80eea1a8305cfafc80..294bf392d06ec2556de3a179da552c703ac7c5d2 100644 --- a/paddle/fluid/imperative/layer.h +++ b/paddle/fluid/imperative/layer.h @@ -127,10 +127,7 @@ class VarBase { public: virtual ~VarBase() { - if (block_ && !persistable_) { - block_->RemoveVar(name_); - } - + // TODO(minqiyang): remove var desc from block desc if (var_) { delete var_; var_ = nullptr; diff --git a/python/paddle/fluid/tests/unittests/test_imperative_ptb_rnn.py b/python/paddle/fluid/tests/unittests/test_imperative_ptb_rnn.py index a0504d3dbc2542e0803c0a6c9312bee21c50ca18..878c27d9344111d18e1ff27a1d4f41f8ae0df4b0 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_ptb_rnn.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_ptb_rnn.py @@ -243,7 +243,7 @@ class TestImperativePtbRnn(unittest.TestCase): dy_loss = None last_hidden = None last_cell = None - batch_num = 200 + batch_num = 50 for i in range(batch_num): x_data = np.arange(12).reshape(4, 3).astype('int64') diff --git a/python/paddle/fluid/tests/unittests/test_imperative_resnet.py b/python/paddle/fluid/tests/unittests/test_imperative_resnet.py index 5e5299bda5f583a8efeae46a002d08adb3a707d2..94ac3933151ac612ea9d308f0e28c73f0c067abf 100644 --- a/python/paddle/fluid/tests/unittests/test_imperative_resnet.py +++ b/python/paddle/fluid/tests/unittests/test_imperative_resnet.py @@ -231,7 +231,7 @@ class TestImperativeResnet(unittest.TestCase): seed = 90 batch_size = train_parameters["batch_size"] - batch_num = 50 + batch_num = 20 with fluid.imperative.guard(): fluid.default_startup_program().random_seed = seed fluid.default_main_program().random_seed = seed