Skip to content

Commit

Permalink
Constant filtering and shape of removal passes are updated
Browse files Browse the repository at this point in the history
  • Loading branch information
daniil-lyakhov committed Nov 16, 2023
1 parent 6c4d598 commit b37bd30
Show file tree
Hide file tree
Showing 17 changed files with 326 additions and 73 deletions.
1 change: 1 addition & 0 deletions nncf/common/graph/operator_metatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class OperatorMetatype:
hw_config_names: List[str] = []
output_channel_axis: Optional[int] = None
ignored_input_ports: List[int] = []
input_edges_num_expected = None

@classmethod
def get_all_aliases(cls) -> List[str]:
Expand Down
2 changes: 2 additions & 0 deletions nncf/common/utils/dot_file_rw.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ def read_dot_graph(path: pathlib.Path) -> nx.DiGraph:
def _maybe_escape_colons_in_attrs(data: Dict):
for attr_name in data:
attr_val = data[attr_name]
if not isinstance(attr_val, str):
continue
if RESERVED_CHAR in attr_val and not (attr_val[0] == '"' or attr_val[-1] == '"'):
data[attr_name] = '"' + data[attr_name] + '"' # escaped colons are allowed

Expand Down
5 changes: 4 additions & 1 deletion nncf/onnx/graph/nncf_graph_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(
self.weight_attrs = weight_attrs if weight_attrs is not None else {}
self.bias_attrs = bias_attrs if bias_attrs is not None else {}
self.node_attrs = node_attrs if node_attrs is not None else {}
self.layer_attributes = layer_attributes
self._layer_attributes = layer_attributes

def has_weight(self) -> bool:
return bool(self.weight_attrs)
Expand All @@ -78,6 +78,9 @@ def has_bias(self) -> bool:
def has_node_attrs(self) -> bool:
return bool(self.node_attrs)

def get_backend_agnostic_attributes(self) -> BaseLayerAttributes:
return self._layer_attributes


def get_constant_weight_port_ids(metatype: ONNXOpMetatype) -> List[int]:
"""
Expand Down
Loading

0 comments on commit b37bd30

Please sign in to comment.