-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Closed
Labels
Description
- OS: Ubuntu
- PyTorch version: 3.0cpu
- How you installed PyTorch (conda, pip, source): conda
- Python version: 3.6
- CUDA/cuDNN version: N/A
- GPU models and configuration: N/A
- GCC version (if compiling from source): N/A
The remainder operator called on LongTensors return an incorrect value when the divisor is above 2**48. Rather than returning a positive number in the range [0,divisor], the remainder operation either returns the original number or the divisor plus the original number. This can be replicated with the following script
import torch
ds = torch.LongTensor([23500,4040,-10321])
q=2**48`
new_ds = torch.LongTensor([23500,4040,q-10321])
while (ds % q).equal(new_ds):
q+=2**32
new_ds = torch.LongTensor([23500,4040,q-10321])
When the script exits the loop new_ds will be a LongTensor with the incorrect value and q will be the divisor.