Reinforcement-learning-with-PyTorch icon indicating copy to clipboard operation
Reinforcement-learning-with-PyTorch copied to clipboard

5_Deep_Q_Network中RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.

Open NikoHsu opened this issue 3 years ago • 3 comments

RuntimeError: Can't call numpy() on Tensor that requires grad. Use tensor.detach().numpy() instead.增加了detach()也一样报错,输出loss图异常

NikoHsu avatar Aug 25 '22 13:08 NikoHsu

在loss反向传播后需要detach()一下才能继续画图

NikoHsu avatar Sep 05 '22 09:09 NikoHsu

感谢大佬

usernameuiui avatar Nov 07 '22 03:11 usernameuiui

您的来信已收到,祝您生活愉快!

ClownW avatar Nov 07 '22 03:11 ClownW