From cda2e2d94cae4672d22b78bf59478550042adc36 Mon Sep 17 00:00:00 2001 From: huzhiqiang <912790387@qq.com> Date: Mon, 21 Sep 2020 19:56:56 +0800 Subject: [PATCH] [Windows] Fix compiling error on develop branch (#4383) --- lite/backends/x86/math/context_project.h | 8 +- lite/backends/x86/math/pooling.cc | 80 +++++++++---------- lite/backends/x86/math/sequence_padding.h | 2 +- lite/backends/x86/parallel.h | 6 +- lite/core/mir/memory_optimize_pass.cc | 2 +- lite/core/mir/static_kernel_pick_pass.h | 2 +- lite/kernels/host/crf_decoding_compute.h | 4 +- lite/kernels/host/multiclass_nms_compute.cc | 8 +- lite/kernels/host/print_compute.cc | 2 +- .../retinanet_detection_output_compute.cc | 16 ++-- lite/kernels/x86/elementwise_op_function.h | 2 +- .../kernels/x86/sequence_arithmetic_compute.h | 6 +- lite/kernels/x86/sequence_conv_compute.h | 4 +- lite/kernels/x86/slice_compute.h | 8 +- lite/model_parser/model_parser.cc | 4 +- lite/operators/conv_op.cc | 2 +- lite/operators/elementwise_ops.cc | 2 +- lite/operators/pool_op.h | 4 +- lite/operators/slice_op.cc | 6 +- lite/tools/build_windows.bat | 1 - 20 files changed, 84 insertions(+), 85 deletions(-) diff --git a/lite/backends/x86/math/context_project.h b/lite/backends/x86/math/context_project.h index 72a2f4ce12..6363488c4c 100644 --- a/lite/backends/x86/math/context_project.h +++ b/lite/backends/x86/math/context_project.h @@ -161,7 +161,7 @@ class ContextProjectFunctor { sequence_width}); if (up_pad > 0) { // add up pad - int padding_rows = std::min( + int padding_rows = (std::min)( up_pad, static_cast(lod_level_0[i + 1] - lod_level_0[i])); for (int k = 0; k < padding_rows; ++k) { @@ -180,10 +180,10 @@ class ContextProjectFunctor { } if (down_pad > 0) { // add down pad int down_pad_begin_row = - std::max(0, - (sequence_height - context_start - context_length) + 1) + + (std::max)( + 0, (sequence_height - context_start - context_length) + 1) + 1; - int padding_begin = std::max(0, context_start - sequence_height); + int padding_begin = (std::max)(0, context_start - sequence_height); int padding_size = sequence_height - context_start >= context_length ? 1 diff --git a/lite/backends/x86/math/pooling.cc b/lite/backends/x86/math/pooling.cc index 4393c42157..ae2a0cd331 100644 --- a/lite/backends/x86/math/pooling.cc +++ b/lite/backends/x86/math/pooling.cc @@ -67,8 +67,8 @@ class Pool2dFunctor { hend = AdaptEndIndex(ph, input_height, output_height); } else { hstart = ph * stride_height - padding_height; - hend = std::min(hstart + ksize_height, input_height); - hstart = std::max(hstart, 0); + hend = (std::min)(hstart + ksize_height, input_height); + hstart = (std::max)(hstart, 0); } for (int pw = 0; pw < output_width; ++pw) { if (adaptive) { @@ -76,8 +76,8 @@ class Pool2dFunctor { wend = AdaptEndIndex(pw, input_width, output_width); } else { wstart = pw * stride_width - padding_width; - wend = std::min(wstart + ksize_width, input_width); - wstart = std::max(wstart, 0); + wend = (std::min)(wstart + ksize_width, input_width); + wstart = (std::max)(wstart, 0); } T ele = pool_process.initial(); @@ -150,8 +150,8 @@ class Pool2dGradFunctor { hend = AdaptEndIndex(ph, input_height, output_height); } else { hstart = ph * stride_height - padding_height; - hend = std::min(hstart + ksize_height, input_height); - hstart = std::max(hstart, 0); + hend = (std::min)(hstart + ksize_height, input_height); + hstart = (std::max)(hstart, 0); } for (int pw = 0; pw < output_width; ++pw) { if (adaptive) { @@ -159,8 +159,8 @@ class Pool2dGradFunctor { wend = AdaptEndIndex(pw, input_width, output_width); } else { wstart = pw * stride_width - padding_width; - wend = std::min(wstart + ksize_width, input_width); - wstart = std::max(wstart, 0); + wend = (std::min)(wstart + ksize_width, input_width); + wstart = (std::max)(wstart, 0); } int pool_size = (exclusive || adaptive) ? (hend - hstart) * (wend - wstart) @@ -228,12 +228,12 @@ class MaxPool2dGradFunctor { for (int c = 0; c < output_channels; ++c) { for (int ph = 0; ph < output_height; ++ph) { int hstart = ph * stride_height - padding_height; - int hend = std::min(hstart + ksize_height, input_height); - hstart = std::max(hstart, 0); + int hend = (std::min)(hstart + ksize_height, input_height); + hstart = (std::max)(hstart, 0); for (int pw = 0; pw < output_width; ++pw) { int wstart = pw * stride_width - padding_width; - int wend = std::min(wstart + ksize_width, input_width); - wstart = std::max(wstart, 0); + int wend = (std::min)(wstart + ksize_width, input_width); + wstart = (std::max)(wstart, 0); bool stop = false; for (int h = hstart; h < hend && !stop; ++h) { @@ -337,8 +337,8 @@ class Pool3dFunctor { dend = AdaptEndIndex(pd, input_depth, output_depth); } else { dstart = pd * stride_depth - padding_depth; - dend = std::min(dstart + ksize_depth, input_depth); - dstart = std::max(dstart, 0); + dend = (std::min)(dstart + ksize_depth, input_depth); + dstart = (std::max)(dstart, 0); } for (int ph = 0; ph < output_height; ++ph) { if (adaptive) { @@ -346,8 +346,8 @@ class Pool3dFunctor { hend = AdaptEndIndex(ph, input_height, output_height); } else { hstart = ph * stride_height - padding_height; - hend = std::min(hstart + ksize_height, input_height); - hstart = std::max(hstart, 0); + hend = (std::min)(hstart + ksize_height, input_height); + hstart = (std::max)(hstart, 0); } for (int pw = 0; pw < output_width; ++pw) { if (adaptive) { @@ -355,8 +355,8 @@ class Pool3dFunctor { wend = AdaptEndIndex(pw, input_width, output_width); } else { wstart = pw * stride_width - padding_width; - wend = std::min(wstart + ksize_width, input_width); - wstart = std::max(wstart, 0); + wend = (std::min)(wstart + ksize_width, input_width); + wstart = (std::max)(wstart, 0); } int output_idx = (pd * output_height + ph) * output_width + pw; T ele = pool_process.initial(); @@ -441,8 +441,8 @@ class Pool3dGradFunctor { dend = AdaptEndIndex(pd, input_depth, output_depth); } else { dstart = pd * stride_depth - padding_depth; - dend = std::min(dstart + ksize_depth, input_depth); - dstart = std::max(dstart, 0); + dend = (std::min)(dstart + ksize_depth, input_depth); + dstart = (std::max)(dstart, 0); } for (int ph = 0; ph < output_height; ++ph) { if (adaptive) { @@ -450,8 +450,8 @@ class Pool3dGradFunctor { hend = AdaptEndIndex(ph, input_height, output_height); } else { hstart = ph * stride_height - padding_height; - hend = std::min(hstart + ksize_height, input_height); - hstart = std::max(hstart, 0); + hend = (std::min)(hstart + ksize_height, input_height); + hstart = (std::max)(hstart, 0); } for (int pw = 0; pw < output_width; ++pw) { if (adaptive) { @@ -459,8 +459,8 @@ class Pool3dGradFunctor { wend = AdaptEndIndex(pw, input_width, output_width); } else { wstart = pw * stride_width - padding_width; - wend = std::min(wstart + ksize_width, input_width); - wstart = std::max(wstart, 0); + wend = (std::min)(wstart + ksize_width, input_width); + wstart = (std::max)(wstart, 0); } int pool_size = @@ -540,16 +540,16 @@ class MaxPool3dGradFunctor { for (int c = 0; c < output_channels; ++c) { for (int pd = 0; pd < output_depth; ++pd) { int dstart = pd * stride_depth - padding_depth; - int dend = std::min(dstart + ksize_depth, input_depth); - dstart = std::max(dstart, 0); + int dend = (std::min)(dstart + ksize_depth, input_depth); + dstart = (std::max)(dstart, 0); for (int ph = 0; ph < output_height; ++ph) { int hstart = ph * stride_height - padding_height; - int hend = std::min(hstart + ksize_height, input_height); - hstart = std::max(hstart, 0); + int hend = (std::min)(hstart + ksize_height, input_height); + hstart = (std::max)(hstart, 0); for (int pw = 0; pw < output_width; ++pw) { int wstart = pw * stride_width - padding_width; - int wend = std::min(wstart + ksize_width, input_width); - wstart = std::max(wstart, 0); + int wend = (std::min)(wstart + ksize_width, input_width); + wstart = (std::max)(wstart, 0); bool stop = false; for (int d = dstart; d < dend && !stop; ++d) { for (int h = hstart; h < hend && !stop; ++h) { @@ -651,8 +651,8 @@ class MaxPool2dWithIndexFunctor { hend = AdaptEndIndex(ph, input_height, output_height); } else { hstart = ph * stride_height - padding_height; - hend = std::min(hstart + ksize_height, input_height); - hstart = std::max(hstart, 0); + hend = (std::min)(hstart + ksize_height, input_height); + hstart = (std::max)(hstart, 0); } for (int pw = 0; pw < output_width; ++pw) { if (adaptive) { @@ -660,8 +660,8 @@ class MaxPool2dWithIndexFunctor { wend = AdaptEndIndex(pw, input_width, output_width); } else { wstart = pw * stride_width - padding_width; - wend = std::min(wstart + ksize_width, input_width); - wstart = std::max(wstart, 0); + wend = (std::min)(wstart + ksize_width, input_width); + wstart = (std::max)(wstart, 0); } T1 ele = static_cast(-FLT_MAX); @@ -794,8 +794,8 @@ class MaxPool3dWithIndexFunctor { dend = AdaptEndIndex(pd, input_depth, output_depth); } else { dstart = pd * stride_depth - padding_depth; - dend = std::min(dstart + ksize_depth, input_depth); - dstart = std::max(dstart, 0); + dend = (std::min)(dstart + ksize_depth, input_depth); + dstart = (std::max)(dstart, 0); } for (int ph = 0; ph < output_height; ++ph) { if (adaptive) { @@ -803,8 +803,8 @@ class MaxPool3dWithIndexFunctor { hend = AdaptEndIndex(ph, input_height, output_height); } else { hstart = ph * stride_height - padding_height; - hend = std::min(hstart + ksize_height, input_height); - hstart = std::max(hstart, 0); + hend = (std::min)(hstart + ksize_height, input_height); + hstart = (std::max)(hstart, 0); } for (int pw = 0; pw < output_width; ++pw) { if (adaptive) { @@ -812,8 +812,8 @@ class MaxPool3dWithIndexFunctor { wend = AdaptEndIndex(pw, input_width, output_width); } else { wstart = pw * stride_width - padding_width; - wend = std::min(wstart + ksize_width, input_width); - wstart = std::max(wstart, 0); + wend = (std::min)(wstart + ksize_width, input_width); + wstart = (std::max)(wstart, 0); } int output_idx = (pd * output_height + ph) * output_width + pw; diff --git a/lite/backends/x86/math/sequence_padding.h b/lite/backends/x86/math/sequence_padding.h index 5512c4aa11..f254242714 100644 --- a/lite/backends/x86/math/sequence_padding.h +++ b/lite/backends/x86/math/sequence_padding.h @@ -35,7 +35,7 @@ inline static uint64_t MaximumSequenceLength( uint64_t seq_num = seq_offset.size() - 1; uint64_t max_seq_len = 0; for (size_t i = 0; i < seq_num; ++i) { - max_seq_len = std::max(max_seq_len, seq_offset[i + 1] - seq_offset[i]); + max_seq_len = (std::max)(max_seq_len, seq_offset[i + 1] - seq_offset[i]); } return max_seq_len; } diff --git a/lite/backends/x86/parallel.h b/lite/backends/x86/parallel.h index 49794b8e15..33ba672778 100644 --- a/lite/backends/x86/parallel.h +++ b/lite/backends/x86/parallel.h @@ -26,7 +26,7 @@ namespace x86 { static void SetNumThreads(int num_threads) { #ifdef PADDLE_WITH_MKLML - int real_num_threads = std::max(num_threads, 1); + int real_num_threads = (std::max)(num_threads, 1); x86::MKL_Set_Num_Threads(real_num_threads); omp_set_num_threads(real_num_threads); #endif @@ -52,14 +52,14 @@ static inline void RunParallelFor(const int64_t begin, } #ifdef PADDLE_WITH_MKLML - int64_t num_threads = std::min(GetMaxThreads(), end - begin); + int64_t num_threads = (std::min)(GetMaxThreads(), end - begin); if (num_threads > 1) { #pragma omp parallel num_threads(num_threads) { int64_t tid = omp_get_thread_num(); int64_t chunk_size = (end - begin + num_threads - 1) / num_threads; int64_t begin_tid = begin + tid * chunk_size; - f(begin_tid, std::min(end, chunk_size + begin_tid)); + f(begin_tid, (std::min)(end, chunk_size + begin_tid)); } return; } diff --git a/lite/core/mir/memory_optimize_pass.cc b/lite/core/mir/memory_optimize_pass.cc index 3817d0049c..bf1867ac3b 100644 --- a/lite/core/mir/memory_optimize_pass.cc +++ b/lite/core/mir/memory_optimize_pass.cc @@ -148,7 +148,7 @@ void MemoryOptimizePass::CollectLifeCycleByDevice( int cur_life = (*lifecycles)[TargetToStr(target_type)][var_name].second; (*lifecycles)[TargetToStr(target_type)][var_name].second = - std::max(max_lifecycle_, cur_life); + (std::max)(max_lifecycle_, cur_life); } } ++max_lifecycle_; diff --git a/lite/core/mir/static_kernel_pick_pass.h b/lite/core/mir/static_kernel_pick_pass.h index 1b6c55e5e2..3ecd92049d 100644 --- a/lite/core/mir/static_kernel_pick_pass.h +++ b/lite/core/mir/static_kernel_pick_pass.h @@ -61,7 +61,7 @@ class StaticKernelPickPass : public mir::StmtPass { float final_score{-1.}; Place winner_place{places[0]}; const int kMax = - std::numeric_limits::max(); + (std::numeric_limits::max)(); size_t place_size = places.size(); // NOTE: We compare kernel's place with place in valid_places to select the diff --git a/lite/kernels/host/crf_decoding_compute.h b/lite/kernels/host/crf_decoding_compute.h index dd0cb85000..8ddb9463ed 100644 --- a/lite/kernels/host/crf_decoding_compute.h +++ b/lite/kernels/host/crf_decoding_compute.h @@ -52,7 +52,7 @@ void Decode(const Tensor& emission_weights, for (int k = 1; k < seq_len; ++k) { for (int i = 0; i < tag_num; ++i) { - T max_score = -std::numeric_limits::max(); + T max_score = -(std::numeric_limits::max)(); int max_j = 0; for (size_t j = 0; j < tag_num; ++j) { T score = alpha_value[(k - 1) * tag_num + j] + @@ -67,7 +67,7 @@ void Decode(const Tensor& emission_weights, } } - T max_score = -std::numeric_limits::max(); + T max_score = -(std::numeric_limits::max)(); int max_i = 0; for (size_t i = 0; i < tag_num; ++i) { T score = alpha_value[(seq_len - 1) * tag_num + i] + w[tag_num + i]; diff --git a/lite/kernels/host/multiclass_nms_compute.cc b/lite/kernels/host/multiclass_nms_compute.cc index 5a09fca72b..414ca978dd 100644 --- a/lite/kernels/host/multiclass_nms_compute.cc +++ b/lite/kernels/host/multiclass_nms_compute.cc @@ -72,10 +72,10 @@ static T JaccardOverlap(const T* box1, const T* box2, const bool normalized) { box2[3] < box1[1]) { return static_cast(0.); } else { - const T inter_xmin = std::max(box1[0], box2[0]); - const T inter_ymin = std::max(box1[1], box2[1]); - const T inter_xmax = std::min(box1[2], box2[2]); - const T inter_ymax = std::min(box1[3], box2[3]); + const T inter_xmin = (std::max)(box1[0], box2[0]); + const T inter_ymin = (std::max)(box1[1], box2[1]); + const T inter_xmax = (std::min)(box1[2], box2[2]); + const T inter_ymax = (std::min)(box1[3], box2[3]); T norm = normalized ? static_cast(0.) : static_cast(1.); T inter_w = inter_xmax - inter_xmin + norm; T inter_h = inter_ymax - inter_ymin + norm; diff --git a/lite/kernels/host/print_compute.cc b/lite/kernels/host/print_compute.cc index 00c8ab7b13..969fbb2d86 100644 --- a/lite/kernels/host/print_compute.cc +++ b/lite/kernels/host/print_compute.cc @@ -128,7 +128,7 @@ class TensorFormatter { void FormatData(const Tensor& print_tensor, std::stringstream& log_stream) { int64_t print_size = summarize_ == -1 ? print_tensor.numel() - : std::min(summarize_, print_tensor.numel()); + : (std::min)(summarize_, print_tensor.numel()); const T* data = print_tensor.data(); // Always kHost, so unnessary to // copy the data from device log_stream << " - data: ["; diff --git a/lite/kernels/host/retinanet_detection_output_compute.cc b/lite/kernels/host/retinanet_detection_output_compute.cc index 95a4bf708e..f92bea7bda 100644 --- a/lite/kernels/host/retinanet_detection_output_compute.cc +++ b/lite/kernels/host/retinanet_detection_output_compute.cc @@ -83,10 +83,10 @@ static inline T JaccardOverlap(const std::vector& box1, box2[3] < box1[1]) { return static_cast(0.); } else { - const T inter_xmin = std::max(box1[0], box2[0]); - const T inter_ymin = std::max(box1[1], box2[1]); - const T inter_xmax = std::min(box1[2], box2[2]); - const T inter_ymax = std::min(box1[3], box2[3]); + const T inter_xmin = (std::max)(box1[0], box2[0]); + const T inter_ymin = (std::max)(box1[1], box2[1]); + const T inter_xmax = (std::min)(box1[2], box2[2]); + const T inter_ymax = (std::min)(box1[3], box2[3]); T norm = normalized ? static_cast(0.) : static_cast(1.); T inter_w = inter_xmax - inter_xmin + norm; T inter_h = inter_ymax - inter_ymin + norm; @@ -183,10 +183,10 @@ void DeltaScoreToPrediction( pred_box_xmax = pred_box_xmax / im_scale; pred_box_ymax = pred_box_ymax / im_scale; - pred_box_xmin = std::max(std::min(pred_box_xmin, im_width - 1), zero); - pred_box_ymin = std::max(std::min(pred_box_ymin, im_height - 1), zero); - pred_box_xmax = std::max(std::min(pred_box_xmax, im_width - 1), zero); - pred_box_ymax = std::max(std::min(pred_box_ymax, im_height - 1), zero); + pred_box_xmin = (std::max)((std::min)(pred_box_xmin, im_width - 1), zero); + pred_box_ymin = (std::max)((std::min)(pred_box_ymin, im_height - 1), zero); + pred_box_xmax = (std::max)((std::min)(pred_box_xmax, im_width - 1), zero); + pred_box_ymax = (std::max)((std::min)(pred_box_ymax, im_height - 1), zero); std::vector one_pred; one_pred.push_back(pred_box_xmin); diff --git a/lite/kernels/x86/elementwise_op_function.h b/lite/kernels/x86/elementwise_op_function.h index 4cb7160097..e4b5a4b10e 100644 --- a/lite/kernels/x86/elementwise_op_function.h +++ b/lite/kernels/x86/elementwise_op_function.h @@ -71,7 +71,7 @@ inline void get_mid_dims(const lite::DDim &x_dims, for (size_t j = 0; j < i; ++j) { (*pre) *= y_dims[j]; } - *n = std::max(x_dims[i + axis], y_dims[i]); + *n = (std::max)(x_dims[i + axis], y_dims[i]); *mid_flag = 1; mid = i; break; diff --git a/lite/kernels/x86/sequence_arithmetic_compute.h b/lite/kernels/x86/sequence_arithmetic_compute.h index 080d0bcd0b..12622a917b 100644 --- a/lite/kernels/x86/sequence_arithmetic_compute.h +++ b/lite/kernels/x86/sequence_arithmetic_compute.h @@ -55,7 +55,7 @@ class SequenceArithmeticCompute auto input_x = x_data + x_seq_offset[i] * inner_size; auto input_y = y_data + y_seq_offset[i] * inner_size; auto t_out = out_data + x_seq_offset[i] * inner_size; - int len = std::min(len_x, len_y); + int len = (std::min)(len_x, len_y); for (int j = 0; j < len; j++) { t_out[j] = input_x[j] + input_y[j]; } @@ -73,7 +73,7 @@ class SequenceArithmeticCompute auto input_x = x_data + x_seq_offset[i] * inner_size; auto input_y = y_data + y_seq_offset[i] * inner_size; auto t_out = out_data + x_seq_offset[i] * inner_size; - int len = std::min(len_x, len_y); + int len = (std::min)(len_x, len_y); for (int j = 0; j < len; j++) { t_out[j] = input_x[j] - input_y[j]; } @@ -91,7 +91,7 @@ class SequenceArithmeticCompute auto input_x = x_data + x_seq_offset[i] * inner_size; auto input_y = y_data + y_seq_offset[i] * inner_size; auto t_out = out_data + x_seq_offset[i] * inner_size; - int len = std::min(len_x, len_y); + int len = (std::min)(len_x, len_y); for (int j = 0; j < len; j++) { t_out[j] = input_x[j] * input_y[j]; } diff --git a/lite/kernels/x86/sequence_conv_compute.h b/lite/kernels/x86/sequence_conv_compute.h index c1a47aa20f..dd0a60583c 100644 --- a/lite/kernels/x86/sequence_conv_compute.h +++ b/lite/kernels/x86/sequence_conv_compute.h @@ -49,8 +49,8 @@ class SequenceConvCompute : public KernelLite { bool padding_trainable = false; const Tensor* padding_data = nullptr; - int up_pad = std::max(0, -context_start); - int down_pad = std::max(0, context_start + context_length - 1); + int up_pad = (std::max)(0, -context_start); + int down_pad = (std::max)(0, context_start + context_length - 1); auto sequence_width = static_cast(in->dims()[1]); std::vector col_shape{in->dims()[0], diff --git a/lite/kernels/x86/slice_compute.h b/lite/kernels/x86/slice_compute.h index d32327668b..4e9870d53f 100644 --- a/lite/kernels/x86/slice_compute.h +++ b/lite/kernels/x86/slice_compute.h @@ -102,9 +102,9 @@ void slice_compute(const lite::Tensor* in, start = starts[i] < 0 ? (starts[i] + dim_value) : starts[i]; end = ends[i] < 0 ? (ends[i] + dim_value) : ends[i]; - start = std::max(start, 0); - end = std::max(end, 0); - end = std::min(end, dim_value); + start = (std::max)(start, 0); + end = (std::max)(end, 0); + end = (std::min)(end, dim_value); CHECK_GT(end, start) << "end should greater than start"; out_dims[axes[i]] = end - start; } @@ -172,7 +172,7 @@ void slice_compute(const lite::Tensor* in, if (start < 0) { start = (start + in_dims[axes[i]]); } - start = std::max(start, 0); + start = (std::max)(start, 0); offsets[axes[i]] = start; } auto in_t = diff --git a/lite/model_parser/model_parser.cc b/lite/model_parser/model_parser.cc index 13e5b44438..145d366b71 100644 --- a/lite/model_parser/model_parser.cc +++ b/lite/model_parser/model_parser.cc @@ -391,7 +391,7 @@ void TensorToStream(std::ostream &os, const lite::Tensor &tensor) { } { // the 3rd field, tensor data uint64_t size = tensor.memory_size(); - CHECK_LT(size, std::numeric_limits::max()) + CHECK_LT(size, (std::numeric_limits::max)()) << "Index overflow when writing tensor"; #ifdef LITE_WITH_CUDA @@ -461,7 +461,7 @@ void SetParamInfoNaive(naive_buffer::ParamDesc *param_desc, } desc.SetDim(tensor.dims().Vectorize()); uint64_t size = tensor.memory_size(); - CHECK_LT(size, std::numeric_limits::max()) + CHECK_LT(size, (std::numeric_limits::max)()) << "Index overflow when writing tensor"; #ifdef LITE_WITH_CUDA diff --git a/lite/operators/conv_op.cc b/lite/operators/conv_op.cc index 38c59a0290..fa18a384fb 100644 --- a/lite/operators/conv_op.cc +++ b/lite/operators/conv_op.cc @@ -62,7 +62,7 @@ void UpdatePaddingAndDilation(std::vector* paddings, if (padding_algorithm == "SAME") { for (size_t i = 0; i < strides.size(); ++i) { int out_size = (data_dims[i + 2] + strides[i] - 1) / strides[i]; - int pad_sum = std::max( + int pad_sum = (std::max)( (out_size - 1) * strides[i] + ksize[i + 2] - data_dims[i + 2], (int64_t)0); int pad_0 = pad_sum / 2; diff --git a/lite/operators/elementwise_ops.cc b/lite/operators/elementwise_ops.cc index 5895bb667a..101b162881 100644 --- a/lite/operators/elementwise_ops.cc +++ b/lite/operators/elementwise_ops.cc @@ -75,7 +75,7 @@ bool ElementwiseOp::InferShapeImpl() const { if (x_dims_array[i] == -1 || y_dims_array[i] == -1) { out_dims_array[i] = -1; } else { - out_dims_array[i] = std::max(x_dims_array[i], y_dims_array[i]); + out_dims_array[i] = (std::max)(x_dims_array[i], y_dims_array[i]); } } param_.Out->Resize(DDim(out_dims_array)); diff --git a/lite/operators/pool_op.h b/lite/operators/pool_op.h index 916ed1dd6f..4a053438a3 100644 --- a/lite/operators/pool_op.h +++ b/lite/operators/pool_op.h @@ -128,8 +128,8 @@ inline void UpdatePadding(std::vector *paddings, for (size_t i = 0; i < strides.size(); ++i) { int out_size = (data_dims[i + 2] + strides[i] - 1) / strides[i]; int pad_sum = - std::max((out_size - 1) * strides[i] + ksize[i] - data_dims[i + 2], - (int64_t)0); + (std::max)((out_size - 1) * strides[i] + ksize[i] - data_dims[i + 2], + (int64_t)0); int pad_0 = pad_sum / 2; int pad_1 = pad_sum - pad_0; *(paddings->begin() + i * 2) = pad_0; diff --git a/lite/operators/slice_op.cc b/lite/operators/slice_op.cc index 9757015848..be48056928 100644 --- a/lite/operators/slice_op.cc +++ b/lite/operators/slice_op.cc @@ -51,9 +51,9 @@ bool SliceOp::InferShapeImpl() const { if (dim_value > 0) { start = starts[i] < 0 ? (starts[i] + dim_value) : starts[i]; end = ends[i] < 0 ? (ends[i] + dim_value) : ends[i]; - start = std::max(start, 0); - end = std::max(end, 0); - end = std::min(end, dim_value); + start = (std::max)(start, 0); + end = (std::max)(end, 0); + end = (std::min)(end, dim_value); out_dims[axes[i]] = end - start; } } diff --git a/lite/tools/build_windows.bat b/lite/tools/build_windows.bat index 1fdb1e66c4..5faad88192 100644 --- a/lite/tools/build_windows.bat +++ b/lite/tools/build_windows.bat @@ -100,7 +100,6 @@ cd "%build_directory%" -DPYTHON_EXECUTABLE="%python_path%" call "%vcvarsall_dir%" amd64 -cd "%build_directory%" if "%BUILD_FOR_CI%"=="ON" ( msbuild /m /p:Configuration=Release lite\lite_compile_deps.vcxproj -- GitLab