Skip to content

Commit

Permalink
[TorchFX] Fix depthwise + transpose conv weights quantization (#2912)
Browse files Browse the repository at this point in the history
### Changes

* Nodes with weights are updated with depthwise and transpose convs

### Reason for changes

* To correctly quantize depthwise and transpose convolutions as they are
missing weights quantizers right now

### Related tickets

#2766 

### Tests

* mobilenet_v3_small reference quantized graph is updated
  • Loading branch information
daniil-lyakhov authored Aug 27, 2024
1 parent 3a9304c commit ec25a29
Show file tree
Hide file tree
Showing 3 changed files with 1,467 additions and 1,317 deletions.
10 changes: 5 additions & 5 deletions nncf/quantization/algorithms/min_max/torch_fx_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,8 @@ def get_ignored_names_by_layer_attributes(nncf_graph: NNCFGraph) -> Set[str]:

@staticmethod
def get_weight_nodes(nncf_graph: NNCFGraph) -> List[NNCFNode]:
retval = set()
for node in nncf_graph.get_all_nodes():
if node.metatype in [om.PTConv1dMetatype, om.PTConv2dMetatype, om.PTConv3dMetatype, om.PTLinearMetatype]:
retval.add(node)
return list(retval)
return [
node
for node in nncf_graph.get_all_nodes()
if issubclass(node.metatype, om.PTOperatorMetatype) and node.metatype.weight_port_ids
]
Loading

0 comments on commit ec25a29

Please sign in to comment.