Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
daniil-lyakhov committed Dec 5, 2023
1 parent 9c40a66 commit 21dbece
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions nncf/openvino/graph/model_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ def remove_fq_from_inputs(model: ov.Model, graph: NNCFGraph) -> ov.Model:
return model_transformer.transform(transformation_layout)


def get_input_nodes(nncf_graph: NNCFGraph) -> List[NNCFNode]:
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[NNCFNode]:
"""
Get all nodes from given nncf_graph that are identified as a input nodes.
Get a list of NNCFNodes to use as start nodes for activation path tracing.
:param nncf_graph: NNCFGraph to work with.
:return: Target NNCFGraph input nodes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from nncf.openvino.graph.metatypes.groups import SHAPEOF_OPERATIONS
from nncf.openvino.graph.metatypes.openvino_metatypes import OVConcatMetatype
from nncf.openvino.graph.metatypes.openvino_metatypes import OVOpMetatype
from nncf.openvino.graph.model_utils import get_input_nodes
from nncf.openvino.graph.model_utils import get_start_nodes_for_activation_path_tracing
from nncf.openvino.graph.node_utils import get_bias_value
from nncf.openvino.graph.node_utils import get_weight_value
from nncf.openvino.graph.node_utils import is_node_with_bias
Expand Down Expand Up @@ -61,7 +61,7 @@ def get_shapeof_metatypes() -> List[OVOpMetatype]:

@staticmethod
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[NNCFNode]:
return get_input_nodes(nncf_graph)
return get_start_nodes_for_activation_path_tracing(nncf_graph)

# Manipulations with bias value and weights

Expand Down
1 change: 1 addition & 0 deletions nncf/quantization/algorithms/accuracy_control/ranker.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ def find_groups_of_quantizers_to_rank(self, quantized_model_graph: NNCFGraph) ->

quantized_model_graph_without_shapeof = remove_shapeof_subgraphs(
deepcopy(quantized_model_graph),
self._algo_backend.get_shapeof_metatypes(),
self._algo_backend.get_start_nodes_for_activation_path_tracing(quantized_model_graph),
)

Expand Down
2 changes: 1 addition & 1 deletion nncf/quantization/algorithms/min_max/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def create_quantizer_insertion_command(

@staticmethod
@abstractmethod
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[OperatorMetatype]:
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[NNCFNode]:
"""
Returns a list of NNCFNodes to use as start nodes for activation path tracing.
Expand Down
2 changes: 1 addition & 1 deletion nncf/quantization/algorithms/min_max/onnx_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def quant_trait_op_dict(self) -> Dict[int, OperatorMetatype]:
return DEFAULT_ONNX_QUANT_TRAIT_TO_OP_DICT

@staticmethod
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[OperatorMetatype]:
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[NNCFNode]:
return nncf_graph.get_input_nodes()

@staticmethod
Expand Down
6 changes: 3 additions & 3 deletions nncf/quantization/algorithms/min_max/openvino_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from nncf.openvino.graph.layer_attributes import OVLayerAttributes
from nncf.openvino.graph.metatypes import openvino_metatypes as om
from nncf.openvino.graph.metatypes.groups import OPERATIONS_WITH_WEIGHTS
from nncf.openvino.graph.model_utils import get_input_nodes
from nncf.openvino.graph.model_utils import get_start_nodes_for_activation_path_tracing
from nncf.openvino.graph.node_utils import get_channel_agnostic_reduction_axes
from nncf.openvino.graph.node_utils import get_weight_channel_axes
from nncf.openvino.graph.transformations.commands import OVQuantizerInsertionCommand
Expand Down Expand Up @@ -104,8 +104,8 @@ def quant_trait_op_dict(self) -> Dict[int, OperatorMetatype]:
return DEFAULT_OV_QUANT_TRAIT_TO_OP_DICT

@staticmethod
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[OperatorMetatype]:
return get_input_nodes(nncf_graph)
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[NNCFNode]:
return get_start_nodes_for_activation_path_tracing(nncf_graph)

@staticmethod
def target_point(target_type: TargetType, target_node_name: str, port_id: int) -> OVTargetPoint:
Expand Down
3 changes: 1 addition & 2 deletions nncf/quantization/algorithms/min_max/torch_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
from nncf.quantization.algorithms.min_max.backend import MinMaxAlgoBackend
from nncf.quantization.fake_quantize import FakeQuantizeParameters
from nncf.quantization.range_estimator import RangeEstimatorParameters
from nncf.torch.graph.graph import PTNNCFGraph
from nncf.torch.graph.graph import PTTargetPoint
from nncf.torch.graph.transformations.commands import PTQuantizerInsertionCommand
from nncf.torch.hardware.config import PTHWConfig
Expand Down Expand Up @@ -115,7 +114,7 @@ def quant_trait_op_dict(self) -> Dict[int, OperatorMetatype]:
return DEFAULT_PT_QUANT_TRAIT_TO_OP_DICT

@staticmethod
def get_start_nodes_for_activation_path_tracing(nncf_graph: PTNNCFGraph) -> List[OperatorMetatype]:
def get_start_nodes_for_activation_path_tracing(nncf_graph: NNCFGraph) -> List[NNCFNode]:
return nncf_graph.get_disconnected_nodes() + nncf_graph.get_input_nodes()

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion tests/common/quantization/test_passes.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def test_filter_constant_nodes(node_between_const_and_op):
)

class ConstantMetatype(OperatorMetatype):
num_expected_input_edges = 1
num_expected_input_edges = 0
pass

class NodeWithWeightMetatype(OperatorMetatype):
Expand Down

0 comments on commit 21dbece

Please sign in to comment.