def __init__(self, input_shape, num_actions, activation, hparams): super(Network, self).__init__() self.input_shape = input_shape self.num_actions = num_actions self.act = ACTS[activation] self.noisy = hparams.noisy if self.noisy: self.layers = nn.Sequential(nn.Linear(input_shape, 128), self.act(), NoisyLinear(128, 128), self.act(), NoisyLinear(128, num_actions)) else: self.layers = nn.Sequential(nn.Linear(input_shape, 128), self.act(), nn.Linear(128, 128), self.act(), nn.Linear(128, num_actions))
def __init__(self, input_shape, num_actions, activation, hparams): super(CnnNetwork, self).__init__() self.input_shape = input_shape self.num_actions = num_actions self.act = ACTS[activation] self.noisy = hparams.noisy self.features = nn.Sequential( nn.Conv2d(input_shape[0], 32, kernel_size=8, stride=4), self.act(), nn.Conv2d(32, 64, kernel_size=4, stride=2), self.act(), nn.Conv2d(64, 64, kernel_size=3, stride=1), self.act()) if self.noisy: self.fc = nn.Sequential(NoisyLinear(self.feature_size(), 512), self.act(), NoisyLinear(512, self.num_actions)) else: self.fc = nn.Sequential(nn.Linear(self.feature_size(), 512), self.act(), nn.Linear(512, self.num_actions))