Skip to content

Commit 6d27a18

Browse files
authored
Merge pull request #124 from klassen9/feature/multiple_default_values
Add support for multiple default configurations
2 parents f08a869 + ab67851 commit 6d27a18

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/qonnx/transformation/general.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,8 +343,14 @@ def apply(self, model):
343343
used_configurations += [node.name]
344344

345345
# set specified defaults
346-
default_configs = {k: v for k, v in model_config["Defaults"].items() if k not in model_config}
347-
default_configs = {k: v[0] for k, v in default_configs.items() if v[1] == "all" or node.op_type in v[1]}
346+
default_values = []
347+
for key, value in model_config["Defaults"].items():
348+
assert len(value) % 2 == 0
349+
if key not in model_config:
350+
for val, op in zip(value[::2], value[1::2]):
351+
default_values.append((key, val, op))
352+
assert not (op == "all" and len(value) > 2)
353+
default_configs = {key: val for key, val, op in default_values if op == "all" or node.op_type in op}
348354
for attr, value in default_configs.items():
349355
inst.set_nodeattr(attr, value)
350356

0 commit comments

Comments
 (0)