diff --git a/lite/backends/x86/math/context_project.h b/lite/backends/x86/math/context_project.h index 72a2f4ce12cbd72b26cd87e97d0178275a4b4abd..6363488c4ccbe0a22245e96d62feab53f6a55185 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 4393c42157bb7667ec2218e8b76f05a2c60bcc86..ae2a0cd3319dad56589b631b961f0e3a1098a45f 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 5512c4aa11fb5dc05283d01b1d6d3da7fb83c064..f254242714d92852498b3cc72fed0a911510e829 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 49794b8e15a8f90a6512798baa842534df879f6b..33ba672778fa53f4af77c8cbb663b163c2b9c5a3 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 3817d0049c9e302b5b39aae6bca96dff2180bd73..bf1867ac3be2c8c9f8c1c39db156eee31b31c127 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 1b6c55e5e2b533c48a4a34feab9e0c5d5a157d73..3ecd92049d0f4838e80d743b82276cb7b6dfa79f 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 dd0cb8500099727a5706b016c285f090cbb4842b..8ddb9463ed1a8b40795ff0ef9782c83317505a84 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 5a09fca72b4bb30ac67b1186cf90c58a5f9a1dd4..414ca978dda878e4cded4f565d372c663047ea96 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 00c8ab7b13597ad33b9fafc878cd553572462a99..969fbb2d86795da66478eb44671d713fdb7836c1 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 95a4bf708e7f03aee9d9ac99323b173287260b13..f92bea7bda351b6502b19a339002f81d87068c2e 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 4cb7160097e320798c1b1e2ee94d7fec8aedc6d6..e4b5a4b10ebc44938e094f999ce042c90597b108 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 080d0bcd0b42f6f59266e56d0f729eb2a28d4179..12622a917b9c4f55dbcb1e10912ad7ea6fab25a4 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 c1a47aa20f4886aa5dddbe6b398e5365abdc16f2..dd0a60583cc04c9032ceda50e7398b2d1b008b9e 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 d32327668bac389e42ff9411be50ce3df42e39ff..4e9870d53f68828c0159f9ec4fa78af02af4e1cb 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 13e5b44438a715107e2f0ce686a7cff570ed541e..145d366b71c0875a4d344bff3cecd474b8aa7a0f 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 38c59a0290b03031e9cbe013a4a10c14c7ad1743..fa18a384fb1f3cf0cd9f5dd2602f5e95ddf2747d 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 5895bb667aa22507d362004627304ecf78e085f1..101b1628810f388c55e8597ce14be12005614017 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 916ed1dd6f036c6c36954622abbbc1361de1b790..4a053438a33418432b36cf3176d2d926241fb54a 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 9757015848e542b7c96c24fc8c5b3b0313d73eaa..be480569289a18cfaf52c511dcb2edbf878158e7 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 1fdb1e66c441fd8a7e6f3d678f3ac4393fdd2a28..5faad8819285e754ba3dfa33fc8911ccb8674efe 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