未验证 提交 c6421019 编写于 作者: Z Zhang Jun 提交者: GitHub

fix compiling werror (#43337)

上级 83abec60
...@@ -316,7 +316,7 @@ class LocalityAwareNMSKernel : public framework::OpKernel<T> { ...@@ -316,7 +316,7 @@ class LocalityAwareNMSKernel : public framework::OpKernel<T> {
auto* boxes_input = ctx.Input<LoDTensor>("BBoxes"); auto* boxes_input = ctx.Input<LoDTensor>("BBoxes");
auto* scores_input = ctx.Input<LoDTensor>("Scores"); auto* scores_input = ctx.Input<LoDTensor>("Scores");
auto* outs = ctx.Output<LoDTensor>("Out"); auto* outs = ctx.Output<LoDTensor>("Out");
auto score_dims = scores_input->dims(); auto& score_dims = scores_input->dims();
auto score_size = score_dims.size(); auto score_size = score_dims.size();
auto& dev_ctx = ctx.template device_context<platform::CPUDeviceContext>(); auto& dev_ctx = ctx.template device_context<platform::CPUDeviceContext>();
......
...@@ -471,7 +471,7 @@ class RetinanetDetectionOutputKernel : public framework::OpKernel<T> { ...@@ -471,7 +471,7 @@ class RetinanetDetectionOutputKernel : public framework::OpKernel<T> {
std::vector<Tensor> box_per_batch_list(boxes_list.size()); std::vector<Tensor> box_per_batch_list(boxes_list.size());
std::vector<Tensor> score_per_batch_list(scores_list.size()); std::vector<Tensor> score_per_batch_list(scores_list.size());
for (size_t j = 0; j < boxes_list.size(); ++j) { 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] = scores_list[j].Slice(i, i + 1);
score_per_batch_list[j].Resize({score_dims[1], score_dims[2]}); score_per_batch_list[j].Resize({score_dims[1], score_dims[2]});
box_per_batch_list[j] = boxes_list[j].Slice(i, i + 1); box_per_batch_list[j] = boxes_list[j].Slice(i, i + 1);
......
...@@ -262,7 +262,7 @@ class SoftmaxFunctor<DeviceContext, float, true, enable_if_CPU<DeviceContext>> { ...@@ -262,7 +262,7 @@ class SoftmaxFunctor<DeviceContext, float, true, enable_if_CPU<DeviceContext>> {
public: public:
void operator()(const DeviceContext& context, const int axis_dim, void operator()(const DeviceContext& context, const int axis_dim,
const framework::Tensor* X, framework::Tensor* Y) { 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>(); const float* in_data = X->data<float>();
float* out_data = Y->data<float>(); float* out_data = Y->data<float>();
const int kBatchDim = 0; const int kBatchDim = 0;
...@@ -387,7 +387,7 @@ class SoftmaxGradFunctor<DeviceContext, T, enable_if_CPU<DeviceContext>> { ...@@ -387,7 +387,7 @@ class SoftmaxGradFunctor<DeviceContext, T, enable_if_CPU<DeviceContext>> {
void operator()(const DeviceContext& context, const int axis_dim, void operator()(const DeviceContext& context, const int axis_dim,
const framework::Tensor* y, const framework::Tensor* y_grad, const framework::Tensor* y, const framework::Tensor* y_grad,
framework::Tensor* x_grad) { framework::Tensor* x_grad) {
auto out_dims = y->dims(); const auto& out_dims = y->dims();
constexpr int kBatchDim = 0; constexpr int kBatchDim = 0;
constexpr int kClassDim = 1; constexpr int kClassDim = 1;
const int num_classes = out_dims[kClassDim]; const int num_classes = out_dims[kClassDim];
......
...@@ -27,7 +27,7 @@ class ShuffleChannelOpKernel : public framework::OpKernel<T> { ...@@ -27,7 +27,7 @@ class ShuffleChannelOpKernel : public framework::OpKernel<T> {
auto* output = ctx.Output<framework::Tensor>("Out"); auto* output = ctx.Output<framework::Tensor>("Out");
int group = ctx.Attr<int>("group"); int group = ctx.Attr<int>("group");
auto input_dims = input->dims(); const auto& input_dims = input->dims();
auto num = input_dims[0]; auto num = input_dims[0];
auto channel = input_dims[1]; auto channel = input_dims[1];
auto height = input_dims[2]; auto height = input_dims[2];
......
...@@ -28,7 +28,7 @@ static void LerpFunction(const Context& ctx, ...@@ -28,7 +28,7 @@ static void LerpFunction(const Context& ctx,
DenseTensor* out) { DenseTensor* out) {
ctx.template Alloc<T>(out); ctx.template Alloc<T>(out);
auto out_dims = out->dims(); const auto& out_dims = out->dims();
auto x_dims = phi::funcs::ExtendDims2Rank(x.dims(), D); auto x_dims = phi::funcs::ExtendDims2Rank(x.dims(), D);
auto y_dims = phi::funcs::ExtendDims2Rank(y.dims(), D); auto y_dims = phi::funcs::ExtendDims2Rank(y.dims(), D);
auto w_dims = phi::funcs::ExtendDims2Rank(weight.dims(), D); auto w_dims = phi::funcs::ExtendDims2Rank(weight.dims(), D);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册