From 4515e6d92d47d9c6ece4f3d63c8c20d0f12b674d Mon Sep 17 00:00:00 2001 From: lvliang Date: Sat, 28 Nov 2020 10:57:41 +0800 Subject: [PATCH] fix-bug-of-moments-precision-error-in-pynative --- mindspore/_extends/builtin_operations.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mindspore/_extends/builtin_operations.py b/mindspore/_extends/builtin_operations.py index a38135c295e..494c4e2c385 100644 --- a/mindspore/_extends/builtin_operations.py +++ b/mindspore/_extends/builtin_operations.py @@ -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