!9149 Fix bug of moments precision error in pynative

From: @joylvliang
Reviewed-by: @chujinjin,@kisnwang,@jjfeing,@chujinjin
Signed-off-by: @chujinjin
This commit is contained in:
mindspore-ci-bot 2020-11-30 09:08:47 +08:00 committed by Gitee
commit d67c54b0dc
1 changed files with 2 additions and 0 deletions

View File

@ -157,6 +157,8 @@ def tuple_to_array(x):
def stop_gradient(x):
"""Implement `stop_gradient`."""
if isinstance(x, Tensor):
return Tensor(x.asnumpy())
return x