Skip to content

Commit 45ef06b

Browse files
authored
Fix SlicesSplit rewrite rule (#2802)
The logic was incorrectly trying access an attribute that does not exist. --------- Signed-off-by: Justin Chu <justinchuby@users.noreply.github.com>
1 parent 83df7df commit 45ef06b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

onnxscript/rewriter/rules/common/_basic_rules.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,11 @@ def check(self, context, x, begin0, end0, axes0, begin1, end1, axes1) -> MatchRe
178178
axes = axes0.const_value.numpy().tolist()
179179
if len(axes) != 1:
180180
return check_result.fail("Axes has more than one dimension.")
181-
if x.shape:
182-
rk = len(x.shape)
181+
if x.shape is not None:
182+
rank = len(x.shape)
183183
else:
184-
rk = x.rank
185-
if axes[0] != -1 and axes[0] != rk - 1:
184+
return check_result.fail("Input rank is not known.")
185+
if axes[0] != -1 and axes[0] != rank - 1:
186186
return check_result.fail("Axes is not -1 or last dimension.")
187187
if (
188188
begin0.const_value is None

0 commit comments

Comments
 (0)