Skip to content

Commit

Permalink
Fix slice op size issue
Browse files Browse the repository at this point in the history
If size[i] == -1, that means extract all elements of demension i subtract the begin[i] .
  • Loading branch information
xuke537 authored Oct 22, 2024
1 parent 35049c9 commit 565a234
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions op_map.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3052,8 +3052,8 @@ struct Slice : public OpMapperBase<EmptyStructPlaceholder> {

for (int i = 0; i < size.size(); i++) {
if (size[i] == -1) { // If size[i] == -1, that means extract all
// elements of demension i.
size[i] = input_tensor->GetShape()[i];
// elements of demension i subtract the begin[i] .
size[i] = input_tensor->GetShape()[i] - begin[i];
}
}

Expand Down

0 comments on commit 565a234

Please sign in to comment.