From c64210197c34201cbf53474bc4e01460884b0430 Mon Sep 17 00:00:00 2001 From: Zhang Jun Date: Tue, 14 Jun 2022 15:11:12 +0800 Subject: [PATCH] fix compiling werror (#43337) --- paddle/fluid/operators/detection/locality_aware_nms_op.cc | 2 +- .../operators/detection/retinanet_detection_output_op.cc | 2 +- paddle/fluid/operators/math/softmax_impl.h | 4 ++-- paddle/fluid/operators/shuffle_channel_op.h | 2 +- paddle/phi/kernels/impl/lerp_kernel_impl.h | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/paddle/fluid/operators/detection/locality_aware_nms_op.cc b/paddle/fluid/operators/detection/locality_aware_nms_op.cc index 3f8bc867418..bbeacd0eb5f 100644 --- a/paddle/fluid/operators/detection/locality_aware_nms_op.cc +++ b/paddle/fluid/operators/detection/locality_aware_nms_op.cc @@ -316,7 +316,7 @@ class LocalityAwareNMSKernel : public framework::OpKernel { auto* boxes_input = ctx.Input("BBoxes"); auto* scores_input = ctx.Input("Scores"); auto* outs = ctx.Output("Out"); - auto score_dims = scores_input->dims(); + auto& score_dims = scores_input->dims(); auto score_size = score_dims.size(); auto& dev_ctx = ctx.template device_context(); diff --git a/paddle/fluid/operators/detection/retinanet_detection_output_op.cc b/paddle/fluid/operators/detection/retinanet_detection_output_op.cc index 4e49a6ed852..a5d22149eca 100644 --- a/paddle/fluid/operators/detection/retinanet_detection_output_op.cc +++ b/paddle/fluid/operators/detection/retinanet_detection_output_op.cc @@ -471,7 +471,7 @@ class RetinanetDetectionOutputKernel : public framework::OpKernel { std::vector box_per_batch_list(boxes_list.size()); std::vector score_per_batch_list(scores_list.size()); for (size_t j = 0; j < boxes_list.size(); ++j) { - auto score_dims = scores_list[j].dims(); + const auto& score_dims = scores_list[j].dims(); score_per_batch_list[j] = scores_list[j].Slice(i, i + 1); score_per_batch_list[j].Resize({score_dims[1], score_dims[2]}); box_per_batch_list[j] = boxes_list[j].Slice(i, i + 1); diff --git a/paddle/fluid/operators/math/softmax_impl.h b/paddle/fluid/operators/math/softmax_impl.h index 33da631d27b..bb3797d2682 100644 --- a/paddle/fluid/operators/math/softmax_impl.h +++ b/paddle/fluid/operators/math/softmax_impl.h @@ -262,7 +262,7 @@ class SoftmaxFunctor> { public: void operator()(const DeviceContext& context, const int axis_dim, const framework::Tensor* X, framework::Tensor* Y) { - auto in_dims = X->dims(); + const auto& in_dims = X->dims(); const float* in_data = X->data(); float* out_data = Y->data(); const int kBatchDim = 0; @@ -387,7 +387,7 @@ class SoftmaxGradFunctor> { void operator()(const DeviceContext& context, const int axis_dim, const framework::Tensor* y, const framework::Tensor* y_grad, framework::Tensor* x_grad) { - auto out_dims = y->dims(); + const auto& out_dims = y->dims(); constexpr int kBatchDim = 0; constexpr int kClassDim = 1; const int num_classes = out_dims[kClassDim]; diff --git a/paddle/fluid/operators/shuffle_channel_op.h b/paddle/fluid/operators/shuffle_channel_op.h index 409acdfdff7..06abd0628ea 100644 --- a/paddle/fluid/operators/shuffle_channel_op.h +++ b/paddle/fluid/operators/shuffle_channel_op.h @@ -27,7 +27,7 @@ class ShuffleChannelOpKernel : public framework::OpKernel { auto* output = ctx.Output("Out"); int group = ctx.Attr("group"); - auto input_dims = input->dims(); + const auto& input_dims = input->dims(); auto num = input_dims[0]; auto channel = input_dims[1]; auto height = input_dims[2]; diff --git a/paddle/phi/kernels/impl/lerp_kernel_impl.h b/paddle/phi/kernels/impl/lerp_kernel_impl.h index 58759308fac..72fa0672a5f 100644 --- a/paddle/phi/kernels/impl/lerp_kernel_impl.h +++ b/paddle/phi/kernels/impl/lerp_kernel_impl.h @@ -28,7 +28,7 @@ static void LerpFunction(const Context& ctx, DenseTensor* out) { ctx.template Alloc(out); - auto out_dims = out->dims(); + const auto& out_dims = out->dims(); auto x_dims = phi::funcs::ExtendDims2Rank(x.dims(), D); auto y_dims = phi::funcs::ExtendDims2Rank(y.dims(), D); auto w_dims = phi::funcs::ExtendDims2Rank(weight.dims(), D); -- GitLab