Skip to content

Commit a4291e1

Browse files
authored
Merge pull request #231 from LinusJungemann/feature/matchNodeAttrSetterAndGetter
Match set_nodeattr and get_nodeattr
2 parents 3ec678b + eda6324 commit a4291e1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/qonnx/custom_op/base.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,17 @@ def get_nodeattr(self, name):
9999
ret = ret.decode("utf-8")
100100
elif dtype == "strings":
101101
ret = [x.decode("utf-8") for x in ret]
102-
elif dtype == "t":
103-
# use numpy helper to convert TensorProto -> np array
104-
ret = np_helper.to_array(ret)
102+
elif dtype == "floats":
103+
# convert from RepeatedScalarContainer to list
104+
# gives e.g. JSON serializability
105+
ret = [x for x in ret]
105106
elif dtype == "ints":
106107
# convert from RepeatedScalarContainer to list
107108
# gives e.g. JSON serializability
108109
ret = [x for x in ret]
110+
elif dtype == "t":
111+
# use numpy helper to convert TensorProto -> np array
112+
ret = np_helper.to_array(ret)
109113
if allowed_values is not None:
110114
assert ret in allowed_values, "%s = %s not in %s" % (
111115
str(name),

0 commit comments

Comments
 (0)