1 简介
本文参考莫烦Python。由于莫烦老师在视频中只是大致介绍了DQN的代码结构,没有对一些细节进行讲解。因此,本文基于莫烦老师的代码,针对代码的每一行进行了解释。
2 相关资料网址
01 《什么是DQN》
什么是 DQN - PyTorch | 莫烦Pythonmofanpy.com02 《DQN强化学习》
DQN 强化学习 - PyTorch | 莫烦Pythonmofanpy.com03 《莫烦老师代码的github网址》
https://github.com/MorvanZhou/PyTorch-Tutorial/blob/master/tutorial-contents/405_DQN_Reinforcement_learning.pygithub.com04 《2013 DeepMind在NIPS上发表的论文》
https://arxiv.org/abs/1312.5602arxiv.org05 《2015 DeepMind在Nature上发表的论文》
Human-level control through deep reinforcement learningwww.nature.com3 DQN伪代码
2013版《Playing Atari with Deep Reinforcement Learning》伪代码:
2015版《Human-level control through deep reinforcement learning》伪代码:
4 代码详解
import torch # 导入torch
import torch.nn as nn # 导入torch.nn
import torch.nn.functional as F # 导入torch.nn.functional
import n