I create a GRU network and initialize hidden as

def init_hidden(self, num_layers, batch_size):
     return torch.autograd.Variable(torch.zeros(num_layers * 2, batch_size, 300)).cuda()


I set batch_size equal 50, but I got a error when test:

RuntimeError: Expected hidden size (2, 1090, 300), got (2, 50, 300)

It seems like I can not test all samples in test data set,. I know something is wrong, but I can’t find it . Thanks for your help. I am new here, and as you see, my English is not good, I hope you can understand what I say.