forked from openvinotoolkit/nncf
-
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.
test_find_groups_of_quantizers_to_rank is presented
- Loading branch information
1 parent
21dbece
commit 4266ed6
Showing
2 changed files
with
122 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright (c) 2023 Intel Corporation | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
from typing import Any, List, Optional | ||
|
||
from nncf.common.graph.graph import NNCFGraph | ||
from nncf.common.graph.graph import NNCFNode | ||
from nncf.common.graph.operator_metatypes import OperatorMetatype | ||
from nncf.quantization.algorithms.accuracy_control.backend import AccuracyControlAlgoBackend | ||
from nncf.quantization.algorithms.accuracy_control.backend import TModel | ||
from tests.common.quantization.metatypes import CONSTANT_METATYPES | ||
from tests.common.quantization.metatypes import QUANTIZABLE_METATYPES | ||
from tests.common.quantization.metatypes import QUANTIZE_AGNOSTIC_METATYPES | ||
from tests.common.quantization.metatypes import QUANTIZER_METATYPES | ||
from tests.common.quantization.metatypes import ShapeOfTestMetatype | ||
|
||
|
||
class AABackendForTests(AccuracyControlAlgoBackend): | ||
@staticmethod | ||
def get_quantizer_metatypes() -> List[OperatorMetatype]: | ||
return QUANTIZER_METATYPES | ||
|
||
@staticmethod | ||
def get_const_metatypes() -> List[OperatorMetatype]: | ||
return CONSTANT_METATYPES | ||
|
||
@staticmethod | ||
def get_quantizable_metatypes() -> List[OperatorMetatype]: | ||
return QUANTIZABLE_METATYPES | ||
|
||
@staticmethod | ||
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[NNCFNode]: | ||
return nncf_graph.get_input_nodes() | ||
|
||
@staticmethod | ||
def get_quantize_agnostic_metatypes() -> List[OperatorMetatype]: | ||
return QUANTIZE_AGNOSTIC_METATYPES | ||
|
||
@staticmethod | ||
def get_shapeof_metatypes() -> List[OperatorMetatype]: | ||
return [ShapeOfTestMetatype] | ||
|
||
@staticmethod | ||
def is_node_with_bias(node: NNCFNode, nncf_graph: NNCFGraph) -> bool: | ||
return False | ||
|
||
@staticmethod | ||
def is_node_with_weight(node: NNCFNode) -> bool: | ||
return False | ||
|
||
@staticmethod | ||
def get_bias_value(node_with_bias: NNCFNode, nncf_graph: NNCFGraph, model: TModel) -> Any: | ||
return None | ||
|
||
@staticmethod | ||
def get_weight_value(node_with_weight: NNCFNode, model: TModel, port_id: int) -> Any: | ||
return None | ||
|
||
@staticmethod | ||
def get_weight_tensor_port_ids(node: NNCFNode) -> List[Optional[int]]: | ||
return None | ||
|
||
@staticmethod | ||
def get_model_size(model: TModel) -> int: | ||
return 0 | ||
|
||
@staticmethod | ||
def prepare_for_inference(model: TModel) -> TModel: | ||
return model |
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