File tree Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Expand file tree Collapse file tree 1 file changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -68,8 +68,16 @@ def define_node(
6868 end_index = _fixup_end (end , shape , dim )
6969 size = end_index - start_index
7070
71- assert size > 0
72- assert size <= shape [dim ]
71+ if size <= 0 :
72+ raise ValueError (
73+ f"The calculated slice size must be positive. Got { size = } "
74+ f"with { start_index = } and { end_index = } ."
75+ )
76+ if size > shape [dim ]:
77+ raise ValueError (
78+ f"The calculated slice size cannot be greater than the dimension size"
79+ f". Got { size = } and { shape [dim ]= } ."
80+ )
7381
7482 # Convert aten args to Tosa's start and size attributes and in TOSA dim order.
7583 attr = ts .TosaSerializerAttribute ()
@@ -122,8 +130,16 @@ def define_node(
122130 end_index = _fixup_end (end , shape , dim )
123131 size = end_index - start_index
124132
125- assert size > 0
126- assert size <= shape [dim ]
133+ if size <= 0 :
134+ raise ValueError (
135+ f"The calculated slice size must be positive. Got { size = } "
136+ f"with { start_index = } and { end_index = } ."
137+ )
138+ if size > shape [dim ]:
139+ raise ValueError (
140+ f"The calculated slice size cannot be greater than the dimension size"
141+ f". Got { size = } and { shape [dim ]= } ."
142+ )
127143
128144 # Convert aten args to Tosa's start and size shape_t tensors and in TOSA dim order.
129145 starts = [
You can’t perform that action at this time.
0 commit comments