def __init__(self, args, input_dim, num_actions):
     nn.Module.__init__(self)
     self.conv1 = nn.Conv2d(input_dim, 32, 8, stride=4, padding=1)
     self.conv2 = nn.Conv2d(32, 64, 4, stride=2)
     self.conv3 = nn.Conv2d(64, 64, 3)
     self.fc1 = BayesBackpropLinear(3136, 512)
     self.fc2 = BayesBackpropLinear(512, num_actions)
     initialize_weights(self)
示例#2
0
 def __init__(self, args, action_space):
     nn.Module.__init__(self)
     self.features = nn.Sequential(
         nn.Linear(args.input_dim, 16),
         nn.ReLU(inplace=True),
         nn.Linear(16, 16),
         nn.ReLU(inplace=True)
     )
     self.last_layer = nn.Linear(16, action_space)
     initialize_weights(self)
 def __init__(self, args, input_dim, num_actions):
     nn.Module.__init__(self)
     self.conv1 = nn.Conv2d(input_dim, 32, 8, stride=4, padding=1)
     self.conv2 = nn.Conv2d(32, 64, 4, stride=2)
     self.conv3 = nn.Conv2d(64, 64, 3)
     self.fc1 = MNFLinear(3136, 512, args.hidden_dim, args.n_hidden,
                          args.n_flows_q, args.n_flows_r)
     self.fc2 = MNFLinear(512, num_actions, args.hidden_dim, args.n_hidden,
                          args.n_flows_q, args.n_flows_r)
     initialize_weights(self)
示例#4
0
    def __init__(self, args, action_space):
        nn.Module.__init__(self)
        # self.features = nn.Sequential(
        #     nn.Linear(args.input_dim, 16),
        #     nn.ReLU(inplace=True)
        # )
        self.nheads = args.nheads
        self.heads = nn.ModuleList([nn.Sequential(nn.Linear(args.input_dim, 16),
        nn.ReLU(inplace=True),
        nn.Linear(16, 16),
        nn.ReLU(inplace=True),
        nn.Linear(16, action_space)) for _ in range(args.nheads)])

        initialize_weights(self)
    def __init__(self, args, input_dim, num_actions):
        nn.Module.__init__(self)

        self.features = nn.Sequential(
            nn.Conv2d(input_dim, 32, 8, stride=4, padding=1),
            nn.ReLU(inplace=True),
            nn.Conv2d(32, 64, 4, stride=2),
            nn.ReLU(inplace=True),
            nn.Conv2d(64, 64, 3),
            nn.ReLU(inplace=True)
        )

        self.nheads = args.nheads
        self.heads = nn.ModuleList([nn.Sequential(nn.Linear(3136, 512),
        nn.ReLU(inplace=True),
        nn.Linear(512, num_actions)) for _ in range(args.nheads)])

        initialize_weights(self)
    def __init__(self, input_dim, hidden_dim, n_hidden):
        nn.Module.__init__(self)
        self.input_dim = input_dim
        self.hidden_dim = hidden_dim
        self.n_hidden = n_hidden

        self.first_layer = nn.Sequential(nn.Linear(input_dim, hidden_dim),
                                         nn.Tanh())

        hidden_modules = []
        for _ in range(n_hidden):
            hidden_modules.append(nn.Linear(hidden_dim, hidden_dim))
            hidden_modules.append(nn.Tanh())

        self.hidden_layer = nn.Sequential(*hidden_modules)
        self.mu_layer = nn.Linear(hidden_dim, input_dim)
        self.sigma_layer = nn.Sequential(nn.Linear(hidden_dim, input_dim),
                                         nn.Sigmoid())
        self.register_buffer('mask', torch.Tensor(input_dim))
        initialize_weights(self)