[TOSA] Add support for sliceOp end < 0 (#2011)

pull/2003/head
Chi_Liu 2023-04-06 16:19:00 -07:00 committed by GitHub
parent 6cab740603
commit 8dcd0b2e76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -3171,8 +3171,10 @@ LogicalResult ConvertAtenOp<AtenSliceTensorOp>::matchAndRewrite(
int64_t end;
if (!matchPattern(op.getEnd(), m_TorchConstantInt(&end)))
return rewriter.notifyMatchFailure(op, "end must be a Scalar constant");
// support for end < 0
end = toPositiveDim(end, selfType.getShape()[dim]);
// FIXME: add support for start/end < 0 and end < start
// FIXME: add support for start < 0 and end < start
if (end < start)
return rewriter.notifyMatchFailure(op,
"Currently unsupported: end < start");