Skip to content

Commit

Permalink
fix the bug when the dim of slice is -1 (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
yitongh authored Dec 11, 2024
1 parent 0a684a8 commit 294a91c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions torch_xla/csrc/aten_xla_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2855,6 +2855,8 @@ at::Tensor XLANativeFunctions::slice_copy_symint(
const at::Tensor& self, int64_t dim, c10::optional<c10::SymInt> start,
c10::optional<c10::SymInt> end, c10::SymInt step) {
TORCH_LAZY_FN_COUNTER_TIMED_TRACING("xla::");
// dim maybe -1
dim = torch::lazy::GetCanonicalDimensionIndex(dim, self.dim());
c10::SymInt start_val = start.has_value() ? start.value() : 0;
c10::SymInt end_val = end.has_value() ? end.value() : self.sym_sizes()[dim];
if (!start_val.is_symbolic() && start_val < 0) {
Expand Down

0 comments on commit 294a91c

Please sign in to comment.