Skip to content

Commit 8dcd0b2

Browse files
author
Chi_Liu
authored
[TOSA] Add support for sliceOp end < 0 (#2011)
1 parent 6cab740 commit 8dcd0b2

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/Conversion/TorchToTosa/TorchToTosa.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3171,8 +3171,10 @@ LogicalResult ConvertAtenOp<AtenSliceTensorOp>::matchAndRewrite(
31713171
int64_t end;
31723172
if (!matchPattern(op.getEnd(), m_TorchConstantInt(&end)))
31733173
return rewriter.notifyMatchFailure(op, "end must be a Scalar constant");
3174+
// support for end < 0
3175+
end = toPositiveDim(end, selfType.getShape()[dim]);
31743176

3175-
// FIXME: add support for start/end < 0 and end < start
3177+
// FIXME: add support for start < 0 and end < start
31763178
if (end < start)
31773179
return rewriter.notifyMatchFailure(op,
31783180
"Currently unsupported: end < start");

0 commit comments

Comments
 (0)