From 26d292b1087ed32edebc179d60b82e96df11895a Mon Sep 17 00:00:00 2001 From: furnace <34057289+windstamp@users.noreply.github.com> Date: Wed, 11 Nov 2020 18:51:49 +0800 Subject: [PATCH] bugfix for api (mv, empty, empty_like op) (#28513) --- python/paddle/tensor/creation.py | 2 -- python/paddle/tensor/linalg.py | 2 -- 2 files changed, 4 deletions(-) diff --git a/python/paddle/tensor/creation.py b/python/paddle/tensor/creation.py index 7b62ae9102d..a69bc64c4cf 100644 --- a/python/paddle/tensor/creation.py +++ b/python/paddle/tensor/creation.py @@ -952,7 +952,6 @@ def empty(shape, dtype=None, name=None): import paddle import numpy as np - paddle.disable_static() # Now we are in imperative mode paddle.set_device("cpu") # and use cpu device # example 1: argument ``shape`` is a list which doesn't contain Tensor. @@ -1036,7 +1035,6 @@ def empty_like(x, dtype=None, name=None): import paddle import numpy as np - paddle.disable_static() # Now we are in imperative mode paddle.set_device("cpu") # and use cpu device x = paddle.randn([2, 3], 'float32') diff --git a/python/paddle/tensor/linalg.py b/python/paddle/tensor/linalg.py index 2745464995f..e46a26bf45b 100644 --- a/python/paddle/tensor/linalg.py +++ b/python/paddle/tensor/linalg.py @@ -921,13 +921,11 @@ def mv(x, vec, name=None): import numpy as np import paddle - paddle.disable_static() x_data = np.array([[2, 1, 3], [3, 0, 1]]).astype("float64") x = paddle.to_tensor(x_data) vec_data = np.array([3, 5, 1]) vec = paddle.to_tensor(vec_data).astype("float64") out = paddle.mv(x, vec) - paddle.enable_static() """ if in_dygraph_mode(): out = core.ops.mv(x, vec) -- GitLab