def __init__(self, env, trainable=True, learning_rate=0.001, hidden=30): nn.Module.__init__(self) Network.__init__(self) self.env = env self.hidden = hidden self.actions = env.action_space.n self.build_model_() if trainable: self.optimizer = optim.Adam(self.parameters(), lr=learning_rate) if USE_CUDA: self.cuda()
def __init__(self, networks, *args, **kwargs): Network.__init__(self) self.networks = [ Network(*args, **kwargs) for Network in networks ]