未验证 提交 9737525a 编写于 作者: S sneaxiy 提交者: GitHub

fix paddle.var() stop_gradient error (#50063)

上级 964cd660
...@@ -158,6 +158,7 @@ def var(x, axis=None, unbiased=True, keepdim=False, name=None): ...@@ -158,6 +158,7 @@ def var(x, axis=None, unbiased=True, keepdim=False, name=None):
if unbiased: if unbiased:
one_const = paddle.ones([], x.dtype) one_const = paddle.ones([], x.dtype)
n = where(n > one_const, n - 1.0, one_const) n = where(n > one_const, n - 1.0, one_const)
n.stop_gradient = True
out /= n out /= n
return out return out
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册