Hey, i think im having the same issue.
Ive attached a simple example, which reproduces the error. I would appreciate any help.
import torch
import torch.nn as nn
import torch.optim as optim
import torch.nn.functional as F
from torch.autograd import Variable



class LSTM(nn.Module):
    def __init__(self, input_size, hidden_size, num_layers):
        super(LSTM, self).__init__()

        self.hidden_size = hidden_size
        self.num_layers = num_layers
        self.rnn = nn.LSTM(
            input_size=input_size,
            hidden_size=hidden_size,
            num_layers=num_layers,
            bidirectional=False, )

    def forward(self, x):
        outputs, _ = self.rnn(x)
        return Variable(x.view(x.size()[0], 1), requires_grad=True)


model = LSTM(
    input_size=1,
    hidden_size=5,
    num_layers=1
)


criterion = nn.MSELoss()

optimizer = optim.SGD(
    params=model.parameters(),
    lr=0.01
)

trainX = torch.randn(5000, 1, 1)
trainY = torch.randn(5000, 1)

for i in range(5):

    outTrain = model(trainX)
    loss = criterion(outTrain, trainY)

    model.zero_grad()
    loss.backward()
    optimizer.step()

Produces error: 0xc00000fd