提交 4da30607 编写于 作者: M minqiyang

Fix bug of gradient interface

上级 08e75731
......@@ -408,7 +408,8 @@ class Variable(object):
self._ivar._run_backward()
def _gradient(self):
return np.array(self._ivar._grad_value())
new_ivar = self._ivar._grad_ivar._copy_to(core.CPUPlace(), True)
return np.array(new_ivar.value().get_tensor())
def _clear_gradient(self):
self._ivar._clear_gradient()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册