Skip to content

Commit 96971fa

Browse files
authored
Merge pull request #1505 from Xilinx/fix/extract_not_set_attributes
Fix extract attributes into json
2 parents 755ea12 + c6b6997 commit 96971fa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/finn/util/config.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ def extract_model_config(model, subgraph_hier, attr_names_to_extract):
3939
if is_custom:
4040
oi = getCustomOp(n)
4141
layer_dict = dict()
42+
for attr in attr_names_to_extract:
43+
try:
44+
layer_dict[attr] = oi.get_nodeattr(attr)
45+
except AttributeError:
46+
pass
4247

4348
# Process node attributes - handle both subgraphs and extractable attributes
4449
for attr in n.attribute:
@@ -53,9 +58,6 @@ def extract_model_config(model, subgraph_hier, attr_names_to_extract):
5358
attr_names_to_extract,
5459
)
5560
)
56-
elif is_custom and attr.name in attr_names_to_extract:
57-
# For custom ops, extract the requested attribute
58-
layer_dict[attr.name] = oi.get_nodeattr(attr.name)
5961

6062
# Add the node's config if we extracted any attributes
6163
if is_custom and len(layer_dict) > 0:

0 commit comments

Comments
 (0)