Skip to content

Commit

Permalink
Comments
Browse files Browse the repository at this point in the history
  • Loading branch information
daniil-lyakhov committed Sep 25, 2024
1 parent 560ae29 commit b4135c8
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 8 deletions.
3 changes: 1 addition & 2 deletions nncf/quantization/algorithms/min_max/onnx_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,5 +269,4 @@ def should_quantize_weight(weight_name: str, quantized_weight_names: Set[str]) -
return weight_name not in quantized_weight_names

def is_matmul_with_constant(self, node: NNCFNode, nncf_graph: NNCFGraph) -> bool:
assert node.metatype in self.mat_mul_metatypes
return node.layer_attributes.has_weight()
return node.metatype in self.mat_mul_metatypes and node.layer_attributes.has_weight()
3 changes: 1 addition & 2 deletions nncf/quantization/algorithms/min_max/openvino_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,8 +264,7 @@ def get_weight_nodes(self, nncf_graph: NNCFGraph) -> List[NNCFNode]:
]

def is_matmul_with_constant(self, node: NNCFNode, nncf_graph: NNCFGraph) -> bool:
assert node.metatype in self.mat_mul_metatypes
return node.layer_attributes is not None
return node.metatype in self.mat_mul_metatypes and node.layer_attributes is not None

@staticmethod
def get_weight_name(nncf_graph: NNCFGraph, target_point: OVTargetPoint) -> str:
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 @@ -384,5 +384,4 @@ def get_weight_nodes(self, nncf_graph: NNCFGraph) -> List[NNCFNode]:
return weight_nodes

def is_matmul_with_constant(self, node: NNCFNode, nncf_graph: NNCFGraph) -> bool:
assert node.metatype in self.mat_mul_metatypes
return len(get_weight_tensor_port_ids(node, nncf_graph)) > 0
return node.metatype in self.mat_mul_metatypes and len(get_weight_tensor_port_ids(node, nncf_graph)) > 0
3 changes: 1 addition & 2 deletions nncf/quantization/algorithms/min_max/torch_fx_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,5 +360,4 @@ def get_weight_nodes(self, nncf_graph: NNCFGraph) -> List[NNCFNode]:
return weight_nodes

def is_matmul_with_constant(self, node: NNCFNode, nncf_graph: NNCFGraph) -> bool:
assert node.metatype in self.mat_mul_metatypes
return len(get_weight_tensor_port_ids(node, nncf_graph)) > 0
return node.metatype in self.mat_mul_metatypes and len(get_weight_tensor_port_ids(node, nncf_graph)) > 0

0 comments on commit b4135c8

Please sign in to comment.