ClownW / Reinforcement-learning-with-PyTorch

Reinforcement learning with PyTorch, inspired by MorvanZhou, change the framework from Tensorflow to PyTorch
256 stars 68 forks source link

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

Open NikoHsu opened 2 years ago

NikoHsu commented 2 years ago

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

NikoHsu commented 2 years ago

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

usernameuiui commented 2 years ago

感谢大佬

ClownW commented 2 years ago

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