diff --git a/python/paddle/tensor/stat.py b/python/paddle/tensor/stat.py index 61a3fbffd72e3e533f12dc022a4e4bbb597a5d0e..e23f28aa76b1b365fe496dfcc54338f40b05500c 100644 --- a/python/paddle/tensor/stat.py +++ b/python/paddle/tensor/stat.py @@ -158,6 +158,7 @@ def var(x, axis=None, unbiased=True, keepdim=False, name=None): if unbiased: one_const = paddle.ones([], x.dtype) n = where(n > one_const, n - 1.0, one_const) + n.stop_gradient = True out /= n return out