diff --git a/paddle/phi/backends/xpu/xpu2_op_list.cc b/paddle/phi/backends/xpu/xpu2_op_list.cc index 77b113c61b005180a240303fd4b73320781ea7f0..a18683f6b52e62f03d14c5f15a615a1962a2ba82 100644 --- a/paddle/phi/backends/xpu/xpu2_op_list.cc +++ b/paddle/phi/backends/xpu/xpu2_op_list.cc @@ -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, diff --git a/python/paddle/fluid/tests/unittests/xpu/test_zero_dim_tensor_xpu.py b/python/paddle/fluid/tests/unittests/xpu/test_zero_dim_tensor_xpu.py index 64085e2fcdc353565b8de906a5f6ce04e2956bf2..97925b72beaa76f7c2e69a5f6d467a6ec1b7c976 100644 --- a/python/paddle/fluid/tests/unittests/xpu/test_zero_dim_tensor_xpu.py +++ b/python/paddle/fluid/tests/unittests/xpu/test_zero_dim_tensor_xpu.py @@ -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])