未验证 提交 16c244bc 编写于 作者: Z Zeng Jinle 提交者: GitHub

Merge pull request #14928 from sneaxiy/fix_gc

Fix gc bug
...@@ -100,7 +100,7 @@ static void DeleteUnusedTensors( ...@@ -100,7 +100,7 @@ static void DeleteUnusedTensors(
continue; continue;
} }
auto* var = scope.FindVar(name); auto* var = scope.FindVar(name);
if (var != nullptr) { if (var == nullptr) {
continue; continue;
} }
......
...@@ -39,6 +39,7 @@ def train(network, use_cuda, use_parallel_executor, batch_size=32, pass_num=2): ...@@ -39,6 +39,7 @@ def train(network, use_cuda, use_parallel_executor, batch_size=32, pass_num=2):
label = fluid.layers.data(name="label", shape=[1], dtype="int64") label = fluid.layers.data(name="label", shape=[1], dtype="int64")
cost = network(data, label, len(word_dict)) cost = network(data, label, len(word_dict))
cost.persistable = True
optimizer = fluid.optimizer.Adagrad(learning_rate=0.2) optimizer = fluid.optimizer.Adagrad(learning_rate=0.2)
optimizer.minimize(cost) optimizer.minimize(cost)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册