ClownW / Reinforcement-learning-with-PyTorch

Reinforcement learning with PyTorch, inspired by MorvanZhou, change the framework from Tensorflow to PyTorch
228 stars 64 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 1 year ago

NikoHsu commented 1 year ago

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

NikoHsu commented 1 year ago

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

usernameuiui commented 1 year ago

感谢大佬

ClownW commented 1 year ago

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