def __init__(self, state_dim, action_dim): """ :param state_dim: Dimension of input state (int) :param action_dim: Dimension of input action (int) :return: """ super(Critic, self).__init__() self.state_dim = state_dim self.action_dim = action_dim print("dimmmmmmmmmm", state_dim, state_dim + action_dim) self.fc1 = nn.Linear(state_dim + action_dim, 400) self.fc1.weight.data = utls.fanin_init(self.fc1.weight.data.size()) self.fc2 = nn.Linear(400, 300) self.fc2.weight.data = utls.fanin_init(self.fc2.weight.data.size()) self.fc3 = nn.Linear(300, 1) self.fc3.weight.data.uniform_(-EPS, EPS) # self.fc3.weight.data = utls.fanin_init(self.fc3.weight.data.size()) self.fca1 = nn.Linear(state_dim + action_dim, 400) self.fca1.weight.data = utls.fanin_init(self.fca1.weight.data.size()) self.fca2 = nn.Linear(400, 300) self.fca2.weight.data = utls.fanin_init(self.fca2.weight.data.size()) self.fca3 = nn.Linear(300, 1) self.fca3.weight.data.uniform_(-EPS, EPS)
def __init__(self, state_dim, action_dim, action_lim=1.): """ :param state_dim: Dimension of input state (int) :param action_dim: Dimension of output action (int) :param action_lim: Used to limit action in [-action_lim,action_lim] :return: """ super(Actor, self).__init__() self.state_dim = state_dim self.action_dim = action_dim self.action_lim = action_lim self.fc1 = nn.Linear(state_dim, 256) self.fc1.weight.data = utls.fanin_init(self.fc1.weight.data.size()) self.fc2 = nn.Linear(256, 128) self.fc2.weight.data = utls.fanin_init(self.fc2.weight.data.size()) self.fc3 = nn.Linear(128, 100) self.fc3.weight.data = utls.fanin_init(self.fc3.weight.data.size()) self.fc4 = nn.Linear(100, 64) self.fc4.weight.data = utls.fanin_init(self.fc4.weight.data.size()) self.fc5 = nn.Linear(64, action_dim) self.fc5.weight.data.uniform_(-EPS, EPS)