Skip to content

Commit 070f039

Browse files
committed
mypy
1 parent 4ebd848 commit 070f039

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

onnx_diagnostic/reference/ort_evaluator.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,9 @@ def input_names(self) -> List[str]:
137137
"Returns input names."
138138
assert self.proto, "self.proto is empty"
139139
if isinstance(self.proto, NodeProto):
140+
assert isinstance(
141+
self.nodes, list
142+
), f"Unexpected type {type(self.nodes)} for self.nodes"
140143
return self.nodes[0].input
141144
return [
142145
getattr(o, "name", o)
@@ -150,6 +153,9 @@ def output_names(self) -> List[str]:
150153
"Returns output names."
151154
assert self.proto, "self.proto is empty"
152155
if isinstance(self.proto, NodeProto):
156+
assert isinstance(
157+
self.nodes, list
158+
), f"Unexpected type {type(self.nodes)} for self.nodes"
153159
return self.nodes[0].output
154160
return [
155161
getattr(o, "name", o)
@@ -217,6 +223,7 @@ def run(
217223
if self.rt_nodes_ is None:
218224
# runs a whole
219225
if self.sess_ is None:
226+
assert self.proto, "self.proto is empty"
220227
_, self.sess_ = self._get_sess(self.proto, list(feed_inputs.values()))
221228
assert self.sess_, "mypy not happy"
222229
return self.sess_.run(outputs, feed_inputs)
@@ -237,7 +244,7 @@ def run(
237244
if i != "" and i not in results:
238245
raise RuntimeError(
239246
f"Unable to find input {i!r} in known results {sorted(results)}, "
240-
f"self.rt_inits_ has {sorted(self.rt_inits_)}, "
247+
f"self.rt_inits_ has {sorted((self.rt_inits_ or {}))}, "
241248
f"feed_inputs has {sorted(feed_inputs)}."
242249
)
243250
inputs = [(results[i] if i != "" else None) for i in node.input]

0 commit comments

Comments
 (0)