seba-1511:

torch.bernoulli(torch.Tensor(x.size(0), self.hidden_size).fill_(self.dropout))


Variable(torch.Tensor(x.size(0), self.hidden_size).fill_(self.dropout).bernoulli_()) is not correct.
The correct form is Variable(torch.Tensor(x.size(0), self.hidden_size).fill_(self.dropout).bernoulli())