Problem running GRU model; missing argument for forward()

You need to provide the hidden state as well which is usually initially all zeros or simply None!
That is you either need to explicitly provide one like this :

hidden_state = torch.zeros(size=(num_layers*direction, batch_size, hidden_dim)).to(device)
pred = Gmodel(inputs, hidden_state)

or simply do :

hidden_state = None 
pred = Gmodel(inputs, hidden_state)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top