未验证 提交 ddc8a726 编写于 作者: J jameszhang 提交者: GitHub

fix xpu unittest issue (#49760)

* fix xpu unittest issue: zero_dim_tensor

* deal with leftout issue introduced by #49470
上级 5e722245
......@@ -269,12 +269,6 @@ XPUOpMap& get_kl2_ops() {
phi::DataType::INT8,
phi::DataType::FLOAT16,
phi::DataType::FLOAT32})},
{"flatten",
XPUKernelSet({phi::DataType::INT64,
phi::DataType::INT32,
phi::DataType::INT8,
phi::DataType::FLOAT16,
phi::DataType::FLOAT32})},
{"flatten_grad",
XPUKernelSet({phi::DataType::INT64,
phi::DataType::INT32,
......
......@@ -747,6 +747,7 @@ class TestSundryAPI(unittest.TestCase):
out1.numpy(),
)
out0.retain_grads()
out0.backward()
self.assertEqual(out0.grad.shape, [1])
self.assertEqual(logit.grad.shape, [2, 3])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册