def select_action(self, state):
    '\n        The action selection function, it either uses the model to choose an action or samples one uniformly.\n        :param state: current state of the model\n        :return:\n        '
    if self.cuda:
        state = state.cuda()
    sample = random.random()
    eps_threshold = (self.config.eps_start + ((self.config.eps_start - self.config.eps_end) * math.exp((((- 1.0) * self.current_iteration) / self.config.eps_decay))))
    self.current_iteration += 1
    if (sample > eps_threshold):
        with torch.no_grad():
            return self.policy_model(state).max(1)[1].view(1, 1)
    else:
        return torch.tensor([[random.randrange(2)]], device=self.device, dtype=torch.long)
The action selection function, it either uses the model to choose an action or samples one uniformly.
:param state: current state of the model
:return:
def select_action(self, state):
    '\n        The action selection function, it either uses the model to choose an action or samples one uniformly.\n        :param state: current state of the model\n        :return:\n        '
    if self.cuda:
        state = state.cuda()
    sample = random.random()
    eps_threshold = (self.config.eps_start + ((self.config.eps_start - self.config.eps_end) * math.exp((((- 1.0) * self.current_iteration) / self.config.eps_decay))))
    self.current_iteration += 1
    if (sample > eps_threshold):
        with torch.no_grad():
            return self.policy_model(state).max(1)[1].view(1, 1)
    else:
        return torch.tensor([[random.randrange(2)]], device=self.device, dtype=torch.long)