def __init__(self): """Build network.""" super().__init__(None, None) self.fc1 = nn.Linear(9, 32) self.fc2 = nn.Linear(32, 32) self.vf = nn.Linear(32, 1) self.dist = Categorical(32, 9)
def build(self): """Build network.""" inshape = self.observation_space.shape[0] self.net = FeedForwardNet(inshape, [32, 32], activate_last=True) if hasattr(self.action_space, 'n'): self.dist = Categorical(32, self.action_space.n) else: self.dist = DiagGaussian(32, self.action_space.shape[0]) self.vf = torch.nn.Linear(32, 1)
def build(self): """Build.""" self.fc1 = nn.Linear(self.observation_space.shape[0], 32) self.fc2 = nn.Linear(32, 32) self.fc3 = nn.Linear(32, 32) if isinstance(self.action_space, gym.spaces.Box): self.dist = TanhDiagGaussian(32, self.action_space.shape[0]) else: self.dist = Categorical(32, self.action_space.n)
def build(self): """Build network.""" self.conv1 = nn.Conv2d(4, 32, 8, 4) self.conv2 = nn.Conv2d(32, 64, 4, 2) self.conv3 = nn.Conv2d(64, 64, 3, 1) shape = self.observation_space.shape[1:] for c in [self.conv1, self.conv2, self.conv3]: shape = conv_out_shape(shape, c) self.nunits = 64 * np.prod(shape) self.fc = nn.Linear(self.nunits, 512) self.dist = Categorical(512, self.action_space.n)
def build(self): """Build.""" self.conv1 = nn.Conv2d(4, 16, 8, 4) self.conv2 = nn.Conv2d(16, 32, 4, 2) shape = self.observation_space.shape[1:] for c in [self.conv1, self.conv2]: shape = conv_out_shape(shape, c) self.nunits = 32 * np.prod(shape) self.fc = nn.Linear(self.nunits, 256) self.vf = nn.Linear(256, 1) self.dist = Categorical(256, self.action_space.n) nn.init.orthogonal_(self.vf.weight.data, gain=1.0) nn.init.constant_(self.vf.bias.data, 0)
def build(self): """Build.""" self.fc1 = nn.Linear(self.observation_space.shape[0], 128) self.fc2 = nn.Linear(128, 128) self.dist = Categorical(128, self.action_space.n)
def __init__(self, action_space): super().__init__() self.fc1 = nn.Linear(64, 32) self.dist = Categorical(32, action_space.n)
def build(self): """Build Network.""" self.fc1 = nn.Linear(self.observation_space.shape[0], 32) self.fc2 = nn.Linear(32, 32) self.fc3 = nn.Linear(32, 32) self.dist = Categorical(32, self.action_space.n)