forked from openvinotoolkit/openvino
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
41 changed files
with
263 additions
and
261 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 0 additions & 69 deletions
69
...ision_transformations/include/low_precision/common/operation_quantization_restriction.hpp
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...ion_transformations/include/low_precision/common/quantization_granularity_restriction.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright (C) 2018-2022 Intel Corporation | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
|
||
#include <ngraph/node.hpp> | ||
#include <ngraph/variant.hpp> | ||
|
||
#include <low_precision/lpt_visibility.hpp> | ||
#include <ngraph/pass/graph_rewrite.hpp> | ||
#include <low_precision/rt_info/quantization_granularity_attribute.hpp> | ||
#include <low_precision/common/port_quantization_granularity_restriction.hpp> | ||
|
||
|
||
namespace ngraph { | ||
namespace pass { | ||
namespace low_precision { | ||
|
||
class QuantizationGranularityRestriction { | ||
public: | ||
ngraph::Node::type_info_t operationType; | ||
bool specifyVersion; | ||
std::vector<PortQuantizationGranularityRestriction> restrictedPorts; | ||
|
||
QuantizationGranularityRestriction() = default; | ||
QuantizationGranularityRestriction( | ||
const ngraph::Node::type_info_t operationType, | ||
const bool specifyVersion, | ||
const std::vector<PortQuantizationGranularityRestriction>& restrictedPorts) : | ||
operationType(operationType), | ||
specifyVersion(specifyVersion), | ||
restrictedPorts(restrictedPorts) {} | ||
|
||
template <typename T> | ||
static QuantizationGranularityRestriction create( | ||
const std::vector<PortQuantizationGranularityRestriction>& restrictedPorts, | ||
const bool specifyVersion) { | ||
return QuantizationGranularityRestriction(T::get_type_info_static(), specifyVersion, restrictedPorts); | ||
} | ||
|
||
template <typename T> | ||
static QuantizationGranularityRestriction create( | ||
const std::vector<size_t>& restrictedPorts = {}, | ||
const bool specifyVersion = false) { | ||
std::vector<PortQuantizationGranularityRestriction> restrictions; | ||
restrictions.reserve(restrictedPorts.size()); | ||
for (auto i = 0ul; i < restrictedPorts.size(); ++i) { | ||
restrictions[i] = PortQuantizationGranularityRestriction(restrictedPorts[i], ngraph::QuantizationGranularityAttribute::Type::PerTensor); | ||
} | ||
return QuantizationGranularityRestriction(T::get_type_info_static(), specifyVersion, restrictions); | ||
} | ||
|
||
template <typename T> | ||
static std::vector<PortQuantizationGranularityRestriction> getPrecisionsByOperationType(std::vector<QuantizationGranularityRestriction>& restrictions) { | ||
for (const auto& restriction : restrictions) { | ||
if (restriction.operationType == T::get_type_info_static()) { | ||
return restriction.restrictedPorts; | ||
} | ||
} | ||
return {}; | ||
} | ||
}; | ||
|
||
} // namespace low_precision | ||
} // namespace pass | ||
} // namespace ngraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.