Skip to content

Commit 21853a8

Browse files
committed
fix
1 parent 3d84e35 commit 21853a8

3 files changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/documentation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ jobs:
109109
grep ERROR doc.txt | grep -v 'l-plot-tiny-llm-export'
110110
exit 1
111111
fi
112-
if [[ $(grep WARNING doc.txt | grep -v 'l-plot-tiny-llm-export' | grep -v 'Inline emphasis start-string' | grep -v 'Definition list ends without a blank line' | grep -v 'Unexpected section title or transition' | grep -v 'Inline strong start-string' | grep -v 'MambaCache') ]]; then
112+
if [[ $(grep WARNING doc.txt | grep -v 'l-plot-tiny-llm-export' | grep -v 'Inline emphasis start-string' | grep -v 'Definition list ends without a blank line' | grep -v 'Unexpected section title or transition' | grep -v 'Inline strong start-string' | grep -v 'MambaCache' | grep 'exported_program_dynamic.rst') ]]; then
113113
echo "Documentation produces warnings."
114-
grep WARNING doc.txt | grep -v 'l-plot-tiny-llm-export' | grep -v 'Inline emphasis start-string' | grep -v 'Definition list ends without a blank line' | grep -v 'Unexpected section title or transition' | grep -v 'Inline strong start-string' | grep -v 'MambaCache'
114+
grep WARNING doc.txt | grep -v 'l-plot-tiny-llm-export' | grep -v 'Inline emphasis start-string' | grep -v 'Definition list ends without a blank line' | grep -v 'Unexpected section title or transition' | grep -v 'Inline strong start-string' | grep -v 'MambaCache' | grep 'exported_program_dynamic.rst'
115115
exit 1
116116
fi
117117

CHANGELOGS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Change Logs
44
0.8.8
55
+++++
66

7+
* :pr:`371`: fix make_fake_with_dynamic_dimensions
8+
79
0.8.7
810
+++++
911

onnx_diagnostic/helpers/fake_tensor_helper.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,11 @@ def make_fake_with_dynamic_dimensions(self, x: Any, dynamic_shapes: Any) -> Any:
209209
for idim, dim in enumerate(x.shape):
210210
if dynamic_shapes is not None and idim in dynamic_shapes:
211211
s = dynamic_shapes[idim]
212+
if s.__class__.__name__ == "Dim":
213+
s = s.__name__
212214
assert isinstance(s, str), (
213215
f"Unexpected type {type(s)} in dynamic_shapes={dynamic_shapes} "
214-
f"at index {idim}"
216+
f"at index {idim}, self._mapping_str={self._mapping_str}"
215217
)
216218
if s in self._mapping_str:
217219
dim = self._mapping_str[s]
@@ -233,6 +235,9 @@ def make_fake_with_dynamic_dimensions(self, x: Any, dynamic_shapes: Any) -> Any:
233235
assert t.device == x.device, f"device mismatch {x.device} -> {t.device}"
234236
assert t.dtype == x.dtype, f"dtype mismatch {x.dtype} -> {t.dtype}"
235237
return t
238+
if isinstance(x, (int, bool, float)):
239+
# It is a constant, we don't change that.
240+
return x
236241
from ..helpers import string_type
237242

238243
raise TypeError(

0 commit comments

Comments
 (0)