aliutkus / torchinterp1d

1D interpolation for pytorch
BSD 3-Clause "New" or "Revised" License
165 stars 19 forks source link

CUDA error: an illegal memory access was encountered when >1023 interpolations #7

Open stefangroha opened 4 years ago

stefangroha commented 4 years ago

Example:

x = torch.tensor([0.2,0.3,0.4,0.5],device=device).float()
y = torch.tensor(np.exp([0.2,0.3,0.4,0.5]),device=device).float()

for i in range(1024):
    Interp1d()(x, y, torch.tensor([0.2,0.3,1.],device=device))

After iteration 1023 I get the following error message:

/opt/conda/lib/python3.7/site-packages/torchinterp1d/interp1d.py in forward(ctx, x, y, xnew, out)
    113         # must be inserted to preserve order. And we want the index of the
    114         # preceeding value.
--> 115         ind -= 1
    116         # we clamp the index, because the number of intervals is x.shape-1,
    117         # and the left neighbour should hence be at most number of intervals

RuntimeError: CUDA error: an illegal memory access was encountered

Thank you for the package and your time!