Compute DQN targets and mean squared temporal-difference loss with terminal masking and a separate target network.