Skip to content

Commit 78bb5de

Browse files
committed
assert
1 parent 2cf2259 commit 78bb5de

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

onnx_diagnostic/reference/ort_evaluator.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,11 @@ def _get_hidden_inputs(self, graph: GraphProto) -> Set[str]:
479479
used by a subgraph.
480480
"""
481481
hidden = set()
482-
memo = set(i.name for i in graph.initializer)
483-
memo |= set(i.name for i in graph.sparse_initializer)
482+
memo = (
483+
{i.name for i in graph.initializer}
484+
| {i.name for i in graph.sparse_initializer}
485+
| {i.name for i in graph.input}
486+
)
484487
for node in graph.node:
485488
for i in node.input:
486489
if i not in memo:
@@ -627,6 +630,10 @@ def _get_sess_init_subgraph(
627630
unique_names.add(i)
628631
value = oh.make_tensor_value_info(i, dtype_to_tensor_dtype(v.dtype), v.shape)
629632
vinputs.append(value)
633+
assert len(reduced_set & set(context)) == len(reduced_set), (
634+
f"Missing hidden inputs {sorted(reduced_set)} from context={sorted(context)} "
635+
f"(len(inputs)={len([i for i in inputs if i])}) for node {pretty_onnx(node)}"
636+
)
630637
return vinputs
631638

632639
def _get_sess_if(

0 commit comments

Comments
 (0)