I have a 2-layer LSTM (torch.nn.LSTM) model, with dropout enabled.
For a task, I need the intermediate gradients as well, I do this by using backward hooks.
But when I call .backward(), I get the following error:
cudnn RNN backward can only be called in training mode
I can bypass this by setting the LSTM layer to .train() but this also enables the dropout.
Can this be fixed?