From 0e1b6144ff02ec1793a947faf330e8bf57bcee81 Mon Sep 17 00:00:00 2001 From: zhangkaihuo Date: Thu, 20 Oct 2022 14:51:31 +0800 Subject: [PATCH] [Sparse] Fix indices (#47190) * fix indices --- paddle/phi/infermeta/sparse/unary.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/paddle/phi/infermeta/sparse/unary.cc b/paddle/phi/infermeta/sparse/unary.cc index 45cb4f75e3..f80f18bbba 100644 --- a/paddle/phi/infermeta/sparse/unary.cc +++ b/paddle/phi/infermeta/sparse/unary.cc @@ -20,7 +20,11 @@ namespace phi { namespace sparse { void IndicesInferMeta(const MetaTensor& x, MetaTensor* out) { - out->set_dims({-1}); + // TODO(zhangkaihuo) Currently, we cannot get sparse_dim from tensor. + // correct shape is: shape[0] = x.sparse_dim() + // In the 3D point cloud model: + // the input x is 5-D tensor, non_zero_elements is 1-D tensor + out->set_dims({x.dims().size() - 1, -1}); out->set_dtype(DataType::INT32); out->set_layout(DataLayout::NCHW); } -- GitLab