Skip to content

Commit

Permalink
[LPT] ConcatTransformation: data movement operation as intermediate h…
Browse files Browse the repository at this point in the history
…andling
  • Loading branch information
eshoguli committed Sep 12, 2020
1 parent f89912a commit 047a55e
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,28 @@ bool Subgraph::fillSubgraphForQuantization(
return true;
}

bool isQuantizationPerChannel(const std::shared_ptr<ngraph::Node>& node) {
if (node->outputs().size() > 1ul) {
return false;
}

for (const Input<Node>& input : node->inputs()) {
if (ngraph::is_type<opset1::Constant>(input.get_node())) {
continue;
}

const Shape& in = input.get_shape();
const Shape& out = node->output(0).get_shape();
for (size_t i = 0; i < 2; ++i) {
if (in[i] != out[i]) {
return false;
}
}
}

return true;
}

bool Subgraph::fill(const std::shared_ptr<ngraph::Node>& layer, std::unordered_set<std::string>& handledLayers) {
// if at least one parent is handled incorrectly then subgraph is not in low precision
for (size_t index = 0; index < layer->get_input_size(); ++index) {
Expand Down Expand Up @@ -117,7 +139,7 @@ bool Subgraph::fill(const std::shared_ptr<ngraph::Node>& layer, std::unordered_s
const std::shared_ptr<ngraph::opset1::FakeQuantize> fakeQuantizeChild = ngraph::as_type_ptr<ngraph::opset1::FakeQuantize>(child);
if (fakeQuantizeChild != nullptr) {
//
} else if (layerTransformationsManager->isPrecisionPreserved(child)) {
} else if (layerTransformationsManager->isPrecisionPreserved(child) && isQuantizationPerChannel(child)) {
if (!fillSubgraphForIntermediate(child, handledLayers)) {
return false;
}
Expand Down

0 comments on commit 047a55e

Please sign in to comment.