未验证 提交 c448032b 编写于 作者: A Aurelius84 提交者: GitHub

[Eager]Fix clear_gradient bug in optimizer (#41658)

上级 59ec9599
......@@ -1112,8 +1112,7 @@ class Optimizer(object):
if _in_eager_without_dygraph_check():
for p in param_list:
clear_func = p._zero_grads if set_to_zero else p.clear_gradient
clear_func()
p.clear_gradient(set_to_zero)
else:
core.clear_gradients(param_list, set_to_zero)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册