Skip to content

Commit

Permalink
Remove variable used for only assertion (#3837)
Browse files Browse the repository at this point in the history
Removes a boolean variable that is used only for an assertion, and
inlines the condition into the assertion.

Signed-off-by: Max Dawkins <[email protected]>
  • Loading branch information
Max191 authored Oct 30, 2024
1 parent 16b3bd6 commit 6b58c89
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Dialect/Torch/IR/TorchOps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4001,10 +4001,9 @@ OpFoldResult AtenSliceTensorOp::fold(FoldAdaptor adaptor) {
limit = limit < 0 ? limit + inType.getSizes()[dimInt] : limit;
limit = limit < 0 ? -1 : limit;
limit = std::min(limit, inType.getSizes()[dimInt]);
bool validIterArgs =
(stride > 0 && begin < limit) || (stride < 0 && begin > limit);
assert(validIterArgs &&
"aten.slice.Tensor iteration args are statically invalid.");
assert((stride > 0 && begin < limit) ||
(stride < 0 && begin > limit) &&
"aten.slice.Tensor iteration args are statically invalid.");

int64_t inputRank = inType.getSizes().size();
llvm::SmallVector<int64_t> inputStrides(inputRank, 1);
Expand Down

0 comments on commit 6b58c89

Please sign in to comment.