The Error is ’ cudnn RNN backward can only be called in training mode.’
I’m doing a DDPG with LSTM network. Part of the code is shown blow.
It works fine on CPU but when run on GPU, it reports the error.
But! As you can see that I’ve ready set the critic network to train mode, why it still reports error literally four lines after that??
    self.target_critic.eval()
    self.critic.eval()

    target_actions=self.target_actor.forward(new_state)
    critic_value_=self.target_critic.forward(new_state,target_actions)
    critic_value=self.critic.forward(state,action)

    target=[]
    for j in range(self.batch_size):
        target.append(reward[j]+self.gamma*critic_value_[j]*done[j])
    target=T.tensor(target).to(self.critic.device)
    target=target.view(self.batch_size,1)
    
    self.critic.train()
    self.critic.optimizer.zero_grad()
    critic_loss=F.mse_loss(target,critic_value)
    critic_loss.backward()
    self.critic.optimizer.step()

I checked the .training boolean value and confirmed that all my networks are in training mode. Yet it still reports the issue