diff --git a/paddle/fluid/operators/beam_search_decode_op_xpu.cc b/paddle/fluid/operators/beam_search_decode_op_xpu.cc index aa7e6ca0476072ed75f0c4a760cb38505c15cdbd..b78cec34cb90011172839974f6b2a6ddfd3d5089 100644 --- a/paddle/fluid/operators/beam_search_decode_op_xpu.cc +++ b/paddle/fluid/operators/beam_search_decode_op_xpu.cc @@ -101,6 +101,8 @@ class BeamSearchDecodeXPUKernel : public framework::OpKernel { xpu::Error_t::SUCCESS, platform::errors::External( "Execute function CopyTensorByXPU failed by [%d]", r)); + sentenceIds_temp->set_lod(sentenceIds->lod()); + sentenceScores_temp->set_lod(sentenceScores->lod()); } } }; diff --git a/paddle/phi/kernels/fusion/xpu/embedding_with_eltwise_add_xpu_kernel.cc b/paddle/phi/kernels/fusion/xpu/embedding_with_eltwise_add_xpu_kernel.cc index afde2f8f3503b24d80e87a1220fc3fd12582ce19..e373ddb60ae0796bd18b6c107bb11262938465f4 100644 --- a/paddle/phi/kernels/fusion/xpu/embedding_with_eltwise_add_xpu_kernel.cc +++ b/paddle/phi/kernels/fusion/xpu/embedding_with_eltwise_add_xpu_kernel.cc @@ -53,8 +53,19 @@ void EmbeddingWithEltwiseAddXpuKernel( std::vector(idx_len, 0)); std::vector> arg_ids; for (int i = 0; i < emb_layer_num; i++) { + PADDLE_ENFORCE_EQ( + ids[i]->dtype() == phi::DataType::INT64 || + ids[i]->dtype() == phi::DataType::INT32, + true, + errors::InvalidArgument( + "The data type of ids should be int64 or int32, but got %s.", + ids[i]->dtype())); for (int j = 0; j < idx_len; j++) { - int_idx[i][j] = static_cast(ids[i]->data()[j]); + if (ids[i]->dtype() == phi::DataType::INT64) { + int_idx[i][j] = static_cast(ids[i]->data()[j]); + } else if (ids[i]->dtype() == phi::DataType::INT32) { + int_idx[i][j] = ids[i]->data()[j]; + } } arg_ids.push_back( xpu::VectorParam{int_idx[i].data(), idx_len, nullptr}); diff --git a/paddle/phi/kernels/xpu/split_kernel.cc b/paddle/phi/kernels/xpu/split_kernel.cc index 674182620bccc5952d4ec32989d959b5c24f4173..6a9bf54876c6a3b9ac22469b9d829ae32dc89831 100644 --- a/paddle/phi/kernels/xpu/split_kernel.cc +++ b/paddle/phi/kernels/xpu/split_kernel.cc @@ -36,6 +36,9 @@ void SplitKernel(const Context& dev_ctx, out_ptrs.push_back(reinterpret_cast(outs[j]->data())); split_lists.push_back(outs[j]->dims()[axis]); } + if (x.numel() == 0) { + return; + } int r = xpu::split(dev_ctx.x_context(), reinterpret_cast(x.data()), out_ptrs,