未验证 提交 8a69292b 编写于 作者: G GGBond8488 提交者: GitHub

【unitest fix】fix xpu unitest error (#50036)

* fix xpu unitest error

* fix xpu unitest error
上级 7a0b0dab
......@@ -134,7 +134,7 @@ class TestExpandAsV2API(unittest.TestCase):
def test_api(self):
input1 = np.random.random([12, 14]).astype("float32")
input2 = np.random.random([2, 12, 14]).astype("float32")
x = paddle.static.data(name='x', shape=[-1, 12, 14], dtype="float32")
x = paddle.static.data(name='x', shape=[12, 14], dtype="float32")
y = paddle.static.data(
name='target_tensor',
......
......@@ -199,14 +199,14 @@ class TestExpandV2API(unittest.TestCase):
input = np.random.random([12, 14]).astype("float32")
x = paddle.static.data(
name='x',
shape=[-1, 12, 14],
shape=[12, 14],
dtype="float32",
)
positive_2 = fluid.layers.fill_constant([1], "int32", 12)
expand_shape = paddle.static.data(
name="expand_shape",
shape=[-1, 2],
shape=[2],
dtype="int32",
)
......
......@@ -94,7 +94,7 @@ class TestIndexSelectAPI(unittest.TestCase):
[5.0, 6.0, 7.0, 8.0],
[9.0, 10.0, 11.0, 12.0],
]
)
).astype('float32')
self.data_index = np.array([0, 1, 1]).astype('int32')
def test_index_select_api(self):
......@@ -102,7 +102,7 @@ class TestIndexSelectAPI(unittest.TestCase):
# case 1:
with program_guard(Program(), Program()):
x = paddle.static.data(name='x', shape=[-1, 4])
x = paddle.static.data(name='x', shape=[-1, 4], dtype='float32')
index = paddle.static.data(name='index', shape=[3], dtype='int32')
z = paddle.index_select(x, index, axis=1)
exe = fluid.Executor(fluid.XPUPlace(0))
......@@ -118,7 +118,7 @@ class TestIndexSelectAPI(unittest.TestCase):
# case 2:
with program_guard(Program(), Program()):
x = paddle.static.data(name='x', shape=[-1, 4])
x = paddle.static.data(name='x', shape=[-1, 4], dtype='float32')
index = paddle.static.data(name='index', shape=[3], dtype='int32')
z = paddle.index_select(x, index)
exe = fluid.Executor(fluid.XPUPlace(0))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册