update PolicyGradient

This commit is contained in:
JohnJim0816
2020-11-27 18:34:04 +08:00
parent 9590e80a2b
commit abfe6ea62b
38 changed files with 210 additions and 22 deletions

View File

@@ -5,7 +5,7 @@ Author: John
Email: johnjim0816@gmail.com
Date: 2020-11-22 23:18:46
LastEditor: John
LastEditTime: 2020-11-23 01:58:22
LastEditTime: 2020-11-27 16:55:25
Discription:
Environment:
'''
@@ -13,11 +13,11 @@ import torch.nn as nn
import torch.nn.functional as F
class FCN(nn.Module):
''' 全连接网络'''
def __init__(self,n_states):
def __init__(self,state_dim):
super(FCN, self).__init__()
# 24和36为hidden layer的层数可根据n_states, n_actions的情况来改变
self.fc1 = nn.Linear(n_states, 24)
self.fc2 = nn.Linear(24, 36)
# 24和36为hidden layer的层数可根据state_dim, n_actions的情况来改变
self.fc1 = nn.Linear(state_dim, 36)
self.fc2 = nn.Linear(36, 36)
self.fc3 = nn.Linear(36, 1) # Prob of Left
def forward(self, x):