[LPT] Support FakeQuantize with convert on intervals (#9579)
* [LPT] Support FakeQuantize with convert on intervals * [LPT] GPU tests
This commit is contained in:
1 parent
12d92dfa2d
commit
b6d60a2c82
10 files changed
+60
-19
No files matched your search
+1
-1
@@ -29,7 +29,7 @@ public:
|
||||
const std::vector<float>& outputLowValues,
|
||||
const std::vector<float>& outputHighValues);
|
||||
|
||||
static bool outputLayoutIsSupported(std::shared_ptr<opset1::FakeQuantize> quantize);
|
||||
static bool outputLayoutIsSupported(std::shared_ptr<opset1::FakeQuantize> quantize, bool isConvertExpected = false);
|
||||
|
||||
static void getInputIntervals(
|
||||
std::shared_ptr<opset1::FakeQuantize> quantize,
|
||||
|
||||
@@ -275,7 +275,7 @@ bool ngraph::pass::low_precision::LowPrecision::isFunctionQuantized(const std::s
|
||||
|
||||
const std::shared_ptr<ngraph::opset1::FakeQuantize> fakeQuantize = ov::as_type_ptr<ngraph::opset1::FakeQuantize>(parent);
|
||||
if ((fakeQuantize != nullptr) &&
|
||||
QuantizationDetails::outputLayoutIsSupported(fakeQuantize) &&
|
||||
QuantizationDetails::outputLayoutIsSupported(fakeQuantize, true) &&
|
||||
QuantizationDetails::isSupportedLevel(fakeQuantize->get_levels())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,11 +49,19 @@ QuantizationDetails::QuantizationDetails(const size_t levels, const std::vector<
|
||||
outputLowValues(outputLowValues),
|
||||
outputHighValues(outputHighValues) {}
|
||||
|
||||
bool QuantizationDetails::outputLayoutIsSupported(std::shared_ptr<opset1::FakeQuantize> quantize) {
|
||||
return ov::is_type<opset1::Constant>(quantize->get_input_node_ptr(1)) &&
|
||||
ov::is_type<opset1::Constant>(quantize->get_input_node_ptr(2)) &&
|
||||
ov::is_type<opset1::Constant>(quantize->get_input_node_ptr(3)) &&
|
||||
ov::is_type<opset1::Constant>(quantize->get_input_node_ptr(4));
|
||||
bool QuantizationDetails::outputLayoutIsSupported(std::shared_ptr<opset1::FakeQuantize> quantize, bool isConvertExpected) {
|
||||
const auto inputs = quantize->inputs();
|
||||
for (size_t i = 1; i < inputs.size(); ++i) {
|
||||
const auto node = inputs[i].get_source_output().get_node_shared_ptr();
|
||||
bool supported = ov::is_type<opset1::Constant>(node);
|
||||
if (!supported && isConvertExpected) {
|
||||
supported = ov::is_type<op::Convert>(node) && ov::is_type<opset1::Constant>(node->get_input_node_ptr(0));
|
||||
}
|
||||
if (!supported) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void QuantizationDetails::getInputIntervals(
|
||||
|
||||
Reference in new issue
Block a user