Cuda runtime error (77) : an illegal memory access was encountered

import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.nn.utils.rnn

class Model(nn.Module):
    def __init__(self):
        super(Model, self).__init__()
        self.lstm = nn.LSTM(batch_first=True,
                            bidirectional=True,
                            input_size=8,
                            hidden_size=252)

    def forward(self):
        output = torch.cuda.DoubleTensor(1,3,8)
        output, (hn, cn) = self.lstm(output) 
        return output

model = Model().cuda()
output = model()
print(output[0, 0, 0])

This code arised an cuda runtime error: ‘an illegal memory access was encountered’. But when I changed the hidden dimentions of LSTM to 251, the error is missing. Can anyone give me a favor? Thanks a lot.

I have solved the question. Actually, change the DoulbeTensor to FloatTensor the error is missing. Related issue can be found here:
https://github.com/pytorch/pytorch/issues/2267