未验证 提交 26d292b1 编写于 作者: F furnace 提交者: GitHub

bugfix for api (mv, empty, empty_like op) (#28513)

上级 c52fe48f
......@@ -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')
......
......@@ -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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册