Revert "[indexing] Prevent integer overflow from large step values in C++ (#161707)"

This reverts commit c140bf217f5ca5071ab9dbc1bcf9d4006242f44a.

Reverted https://github.com/pytorch/pytorch/pull/161707 on behalf of https://github.com/huydhn due to Look like there is a land race as lots of jobs are failing after this lands ([comment](https://github.com/pytorch/pytorch/pull/161707#issuecomment-3283980465))
This commit is contained in:
PyTorch MergeBot
2025-09-12 06:49:36 +00:00
parent 333e546c02
commit 00e9ba75cd
3 changed files with 2 additions and 28 deletions

View File

@ -759,8 +759,7 @@ def slice_forward(
storage_offset = self.storage_offset() + start_val * strides[dim]
len = end_val - start_val
# safely round-up for corresponding c++ impl
sizes[dim] = (len // step) + (1 if len % step != 0 else 0)
sizes[dim] = (len + step - 1) // step
strides[dim] *= step
if self.is_quantized: