From: Gorokhov Dmitriy Date: Thu, 13 Aug 2020 05:39:08 +0000 (+0300) Subject: [CPU] Disable quantize ranges validation in order to avoid regressions (#1720) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ce90329b26b0a6c30741f1e0c517537ced84d3fa;p=platform%2Fupstream%2Fdldt.git [CPU] Disable quantize ranges validation in order to avoid regressions (#1720) --- diff --git a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_quantize_node.cpp b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_quantize_node.cpp index 96606c7..fc54642 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_quantize_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_quantize_node.cpp @@ -14,6 +14,9 @@ #include #include +// Quantization ranges validation is switched off by default in order to avoid regressions on user side +// #define VALIDATE_QUANTIZATION_RANGES + using namespace mkldnn; using namespace MKLDNNPlugin; using namespace InferenceEngine; @@ -221,10 +224,12 @@ void MKLDNNQuantizeNode::init() { float il = inputLowData[isInputLowBroadcasted ? 0 : i]; float ih = inputHighData[isInputHighBroadcasted ? 0 : i]; - if (il == ih) { - if (levels != 2) - THROW_IE_EXCEPTION << "Quantize layer with name '" << getName() << "' has wrong input quantize ranges"; +#if defined(VALIDATE_QUANTIZATION_RANGES) + if ((il == ih && levels != 2) || std::isnan(il) || std::isnan(ih) || std::isinf(il) || std::isinf(ih)) { + THROW_IE_EXCEPTION << "Quantize layer with name '" << getName() << "' has invalid input quantize ranges: " + << "inputLow = " << il << ", inputHigh = " << ih; } +#endif inputScale[i] = (levels - 1) / (ih - il); inputShift[i] = -il * (levels - 1) / (ih - il); @@ -234,10 +239,12 @@ void MKLDNNQuantizeNode::init() { float ol = outputLowData[isOutputLowBroadcasted ? 0 : i]; float oh = outputHighData[isOutputHighBroadcasted ? 0 : i]; - if (ol == oh) { - if (levels != 2) - THROW_IE_EXCEPTION << "Quantize layer with name '" << getName() << "' has wrong output quantize ranges"; +#if defined(VALIDATE_QUANTIZATION_RANGES) + if (std::isnan(ol) || std::isnan(oh) || std::isinf(ol) || std::isinf(oh)) { + THROW_IE_EXCEPTION << "Quantize layer with name '" << getName() << "' has wrong output quantize ranges: " + << "outputLow = " << ol << ", outputHigh = " << oh; } +#endif outputScale[i] = (oh - ol) / (levels - 1);