Skip to content

Commit 18f77de

Browse files
committed
mypy
1 parent bbba6df commit 18f77de

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

onnx_diagnostic/export/dynamic_shapes.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ def process_inputs(
730730
@property
731731
def true_model_name(self) -> str:
732732
"Returns class name or module name."
733+
assert self.model is not None, "model was None when the class was initialized."
733734
return (
734735
self.model.__class__.__name__
735736
if isinstance(self.model, torch.nn.Module)
@@ -987,6 +988,10 @@ def move_to_kwargs(
987988
with the corresponding dynamic shapes.
988989
*kwargs*, *dynamic_shapes* are modified inplace.
989990
"""
991+
assert self.signature is not None, (
992+
"model was None when the class was initialized, "
993+
"cannot move args to kwargs without the signature."
994+
)
990995
sig = self.signature
991996
arg_dyn, kw_dyn = dynamic_shapes
992997
for i, p in enumerate(sig.parameters):

onnx_diagnostic/export/shape_helper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def guess_dynamic_shapes_from_inputs(
103103
ds = guess_dynamic_shapes_from_inputs([inputs1, inputs2], auto="d")
104104
pprint.pprint(ds)
105105
106-
This function returns sometihng equivalent to function
106+
This function returns something equivalent to function
107107
:class:`torch.export.dynamic_shapes.AdditionalInputs` but this
108108
one needs a model.
109109
@@ -120,7 +120,7 @@ def guess_dynamic_shapes_from_inputs(
120120
ds = torch.export.dynamic_shapes.AdditionalInputs()
121121
ds.add((), data["inputs"])
122122
ds.add((), data["inputs2"])
123-
pprint.pprint(ds.dynamic_shapes(data["model"], (), inputs1))
123+
pprint.pprint(ds.dynamic_shapes(data["model"], (), data["inputs"]))
124124
"""
125125
mi = ModelInputs(None, inputs)
126126
return mi.guess_dynamic_shapes(auto=auto)

0 commit comments

Comments
 (0)