Skip to content

Commit f25557b

Browse files
committed
[ModelWrapper] handle empty string tensor names
1 parent 7598ff9 commit f25557b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/qonnx/core/modelwrapper.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,6 +510,9 @@ def make_empty_exec_context(self):
510510
# fill in the constants provided by the initializers (TensorProto to npy)
511511
for t in graph.initializer:
512512
execution_context[t.name] = np_helper.to_array(t)
513+
# for nodes that use empty string as input (=default value), create a
514+
# dummy entry in the context
515+
execution_context[""] = None
513516
return execution_context
514517

515518
def check_all_tensor_shapes_specified(self, fix_missing_init_shape=False):
@@ -525,7 +528,9 @@ def check_all_tensor_shapes_specified(self, fix_missing_init_shape=False):
525528
# see https://github.com/fastmachinelearning/qonnx/issues/33
526529
for n in graph.node:
527530
for i in n.input:
528-
ret = (self.get_tensor_shape(i, fix_missing_init_shape=fix_missing_init_shape) is not None) and ret
531+
# skip tensor names with empty string (indicates defaults)
532+
if i != "":
533+
ret = (self.get_tensor_shape(i, fix_missing_init_shape=fix_missing_init_shape) is not None) and ret
529534
for o in n.output:
530535
ret = (self.get_tensor_shape(o, fix_missing_init_shape=fix_missing_init_shape) is not None) and ret
531536
return ret

0 commit comments

Comments
 (0)