File tree Expand file tree Collapse file tree 2 files changed +7
-2
lines changed
Expand file tree Collapse file tree 2 files changed +7
-2
lines changed Original file line number Diff line number Diff 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 ):
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments