From b3829c58a8cd34f7ab7f854d735033640d7d240e Mon Sep 17 00:00:00 2001 From: Maxim Andronov Date: Wed, 9 Sep 2020 18:57:58 +0300 Subject: [PATCH] [CPU] add const and precision check quantize ranges (#2074) --- inference-engine/src/mkldnn_plugin/nodes/mkldnn_quantize_node.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) 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 d9b35ec..17521f2 100644 --- a/inference-engine/src/mkldnn_plugin/nodes/mkldnn_quantize_node.cpp +++ b/inference-engine/src/mkldnn_plugin/nodes/mkldnn_quantize_node.cpp @@ -124,6 +124,14 @@ void MKLDNNQuantizeNode::init() { THROW_IE_EXCEPTION << "Unsupported input sizes for Quantize layer with name " << getName(); } + for (size_t i = 1; i < getParentEdges().size(); i++) { + if (!getParentEdgesAtPort(i)[0]->getParent()->isConstant()) + THROW_IE_EXCEPTION << "Quantize layer with name " << getName() << " has non const input on " << i << " port"; + auto prec = getCnnLayer()->insData[i].lock()->getPrecision(); + if (prec != Precision::FP32) + THROW_IE_EXCEPTION << "Quantize layer with name " << getName() << " has unsupported precision " << prec << " on " << i << " port"; + } + auto inputLowBlob = dynamic_cast*>(getParentEdgesAtPort(1)[0]->getParent()->getCnnLayer()->blobs["custom"].get()); auto inputLowData = inputLowBlob->buffer().as(); -- 2.7.4