From ae428a0ad9bf1d1a9cd684b64eb3e3a792a2c267 Mon Sep 17 00:00:00 2001 From: engineer1109 <1292846099@qq.com> Date: Tue, 14 Mar 2023 18:50:49 +0800 Subject: [PATCH] fix -Werror=maybe-uninitialized (#51608) --- paddle/fluid/operators/detection/multiclass_nms_op.cc | 2 +- paddle/fluid/operators/fused/fusion_repeated_fc_relu_op.cc | 2 +- paddle/fluid/pybind/tensor_py.h | 2 +- paddle/phi/kernels/cpu/matrix_nms_kernel.cc | 2 +- paddle/phi/kernels/cpu/multiclass_nms3_kernel.cc | 2 +- paddle/phi/kernels/sparse/cpu/sparse_utils_kernel.cc | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/operators/detection/multiclass_nms_op.cc b/paddle/fluid/operators/detection/multiclass_nms_op.cc index 9dc6a8cc1f2..ed5fca119cf 100644 --- a/paddle/fluid/operators/detection/multiclass_nms_op.cc +++ b/paddle/fluid/operators/detection/multiclass_nms_op.cc @@ -361,7 +361,7 @@ class MultiClassNMSKernel : public framework::OpKernel { auto index = ctx.Output("Index"); bool has_roisnum = ctx.HasInput("RoisNum") ? true : false; auto rois_num = ctx.Input("RoisNum"); - auto score_dims = scores->dims(); + auto score_dims = phi::vectorize(scores->dims()); auto score_size = score_dims.size(); auto& dev_ctx = ctx.template device_context(); diff --git a/paddle/fluid/operators/fused/fusion_repeated_fc_relu_op.cc b/paddle/fluid/operators/fused/fusion_repeated_fc_relu_op.cc index fcbc3237cc0..b42c52cf5ca 100644 --- a/paddle/fluid/operators/fused/fusion_repeated_fc_relu_op.cc +++ b/paddle/fluid/operators/fused/fusion_repeated_fc_relu_op.cc @@ -153,7 +153,7 @@ class FusionRepeatedFCReluKernel : public framework::OpKernel { auto place = ctx.GetPlace(); int weight_sz = static_cast(weights.size()); - auto i_dims = in->dims(); + auto i_dims = phi::vectorize(in->dims()); const auto& w_dims = weights[0]->dims(); phi::jit::matmul_attr_t attr; attr.m = i_dims[0]; diff --git a/paddle/fluid/pybind/tensor_py.h b/paddle/fluid/pybind/tensor_py.h index 607aa5a894c..ea024205faf 100644 --- a/paddle/fluid/pybind/tensor_py.h +++ b/paddle/fluid/pybind/tensor_py.h @@ -689,7 +689,7 @@ void _sliceCompute(const phi::DenseTensor *in, const std::vector &axes, const std::vector &starts) { auto &eigen_place = *ctx.eigen_device(); - auto out_dims = out->dims(); + auto out_dims = phi::vectorize(out->dims()); auto in_dims = in->dims(); auto offsets = Eigen::DSizes(); diff --git a/paddle/phi/kernels/cpu/matrix_nms_kernel.cc b/paddle/phi/kernels/cpu/matrix_nms_kernel.cc index 3c51468e7c7..942b7fabf6a 100644 --- a/paddle/phi/kernels/cpu/matrix_nms_kernel.cc +++ b/paddle/phi/kernels/cpu/matrix_nms_kernel.cc @@ -255,7 +255,7 @@ void MatrixNMSKernel(const Context& ctx, DenseTensor* out, DenseTensor* index, DenseTensor* roisnum) { - auto score_dims = scores.dims(); + auto score_dims = phi::vectorize(scores.dims()); auto batch_size = score_dims[0]; auto num_boxes = score_dims[2]; auto box_dim = bboxes.dims()[2]; diff --git a/paddle/phi/kernels/cpu/multiclass_nms3_kernel.cc b/paddle/phi/kernels/cpu/multiclass_nms3_kernel.cc index dc82ffbea87..d7772e1c3be 100644 --- a/paddle/phi/kernels/cpu/multiclass_nms3_kernel.cc +++ b/paddle/phi/kernels/cpu/multiclass_nms3_kernel.cc @@ -496,7 +496,7 @@ void MultiClassNMSKernel(const Context& ctx, DenseTensor* nms_rois_num) { bool return_index = index != nullptr; bool has_roisnum = rois_num.get_ptr() != nullptr; - auto score_dims = scores.dims(); + auto score_dims = phi::vectorize(scores.dims()); auto score_size = score_dims.size(); std::vector>> all_indices; diff --git a/paddle/phi/kernels/sparse/cpu/sparse_utils_kernel.cc b/paddle/phi/kernels/sparse/cpu/sparse_utils_kernel.cc index dcb4399aa28..99ccb878e42 100644 --- a/paddle/phi/kernels/sparse/cpu/sparse_utils_kernel.cc +++ b/paddle/phi/kernels/sparse/cpu/sparse_utils_kernel.cc @@ -258,7 +258,7 @@ void CooToDenseCPUKernel(const CPUContext& dev_ctx, const auto dense_dims = x.dims(); const auto indices = x.indices(); const auto values = x.values(); - const auto indices_dims = indices.dims(); + const auto indices_dims = phi::vectorize(indices.dims()); int64_t sparse_dim = indices_dims[0]; if (indices_dims.size() == 1) { sparse_dim = 1; -- GitLab