diff --git a/paddle/phi/api/yaml/sparse_ops.yaml b/paddle/phi/api/yaml/sparse_ops.yaml index a7111e5dee3c6b70b2127e9ee1330b6be95a957b..a7b0d7a323bf92496dcde08ae2b753f1403dccb0 100644 --- a/paddle/phi/api/yaml/sparse_ops.yaml +++ b/paddle/phi/api/yaml/sparse_ops.yaml @@ -379,7 +379,8 @@ args : (Tensor input, Tensor x, Tensor y, float alpha=1.0, float beta=1.0) output : Tensor(out) infer_meta : - func : AddmmInferMeta + func : UnchangedInferMeta + param : [input] kernel : func : addmm_csr_dense {dense, sparse_csr, dense -> dense}, addmm_csr_csr {sparse_csr, sparse_csr, sparse_csr -> sparse_csr}, diff --git a/paddle/phi/kernels/sparse/empty_kernel.cc b/paddle/phi/kernels/sparse/empty_kernel.cc index 96a7301c5893dee3b1bd33276d3d58f4601541b4..49a377ca70f67d1170739f5650e76863e7f367a9 100644 --- a/paddle/phi/kernels/sparse/empty_kernel.cc +++ b/paddle/phi/kernels/sparse/empty_kernel.cc @@ -31,6 +31,7 @@ void EmptyLikeCooKernel(const Context& dev_ctx, const DenseTensor& x_values = x.values(); DenseTensor* out_values = out->mutable_values(); out_values->Resize(x_values.dims()); + out->set_meta(x.meta()); dev_ctx.template Alloc(out_values); } @@ -44,6 +45,7 @@ void EmptyLikeCsrKernel(const Context& dev_ctx, const DenseTensor& x_values = x.values(); DenseTensor* out_values = out->mutable_values(); out_values->Resize(x_values.dims()); + out->set_meta(x.meta()); dev_ctx.template Alloc(out_values); }