From 100586af09fc7190639729d92656b720523ec9cd Mon Sep 17 00:00:00 2001 From: ciyong Date: Sun, 21 Apr 2019 20:52:49 +0800 Subject: [PATCH] Change size_t to int within for loop to fix windows build error (#14740) * change size_t to int for supporting OpenMp 2.0 windows build * change int to index_t --- .../quantization/mkldnn/mkldnn_quantized_fully_connected.cc | 2 +- src/operator/subgraph/mkldnn/mkldnn_fc.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc b/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc index 71daf2ec2c16..cf3d789e2882 100644 --- a/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc +++ b/src/operator/quantization/mkldnn/mkldnn_quantized_fully_connected.cc @@ -74,7 +74,7 @@ void MKLDNNQuantizedFullyConnectedForward(const nnvm::NodeAttrs &attrs, int32_t *quantized_bias_ptr = quantized_bias.data().dptr(); size_t bias_size = bias.shape().Size(); #pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount()) - for (size_t i = 0; i < bias_size; ++i) { + for (index_t i = 0; i < static_cast(bias_size); ++i) { quantized_bias_ptr[i] = bias_ptr[i] * bias_int32_rescale; } } diff --git a/src/operator/subgraph/mkldnn/mkldnn_fc.cc b/src/operator/subgraph/mkldnn/mkldnn_fc.cc index 0ec05a2af087..857a27d9a134 100644 --- a/src/operator/subgraph/mkldnn/mkldnn_fc.cc +++ b/src/operator/subgraph/mkldnn/mkldnn_fc.cc @@ -156,7 +156,7 @@ void SgMKLDNNFCOp::Forward(const OpContext &ctx, int32_t *quantized_bias_ptr = cached_bias_.data().dptr(); size_t bias_size = bias.shape().Size(); #pragma omp parallel for num_threads(engine::OpenMP::Get()->GetRecommendedOMPThreadCount()) - for (size_t i = 0; i < bias_size; ++i) { + for (index_t i = 0; i < static_cast(bias_size); ++i) { quantized_bias_ptr[i] = bias_ptr[i] * bias_int32_rescale; } }