Skip to content

Commit

Permalink
Fix out of range error in SmallVector (CI test before squash)
Browse files Browse the repository at this point in the history
  • Loading branch information
qedawkins committed Jul 24, 2022
1 parent e6f0529 commit 2bd287b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Conversion/TorchToLinalg/IndirectDataMovement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ class ConvertAtenIndexTensorOp : public OpConversionPattern<AtenIndexTensorOp> {
resultShape.append(broadcastedIndexShape);
int j = 0;
for (auto i : llvm::seq(0, inputRank)) {
if (i == indexTensorDims[j]) {
if (j < replacedIndexCount && i == indexTensorDims[j]) {
j++;
continue;
}
Expand Down Expand Up @@ -456,7 +456,7 @@ class ConvertAtenIndexTensorOp : public OpConversionPattern<AtenIndexTensorOp> {
} else {
int indexCount = 0, unchanged = 0;
for (auto i : llvm::seq(0, inputRank)) {
if (i == indexTensorDims[indexCount]) {
if (indexCount < replacedIndexCount && i == indexTensorDims[indexCount]) {
extractionIndices.push_back(
castIntToIndex(b, loc, args[indexCount++]));
continue;
Expand Down

0 comments on commit 2bd287b

Please sign in to comment.