def _train(self, state_action_tensor, expected_values_tensor):
    'Train the model for 1 epoch.\n\n        Args:\n            state_action_tensor: pytorch tensor with state-action expected_values.\n            expected_values: pytorch tensor with expected values for each state-action.\n\n        Returns:\n            The loss before trainig.\n        '
    if (self.model is None):
        self._init_model(state_action_tensor.shape[1])
    self.optimizer.zero_grad()
    output = self.model(state_action_tensor)
    loss = self.criterion(output, expected_values_tensor)
    loss_value = loss.data.item()
    loss.backward()
    self.optimizer.step()
    return loss_value
Train the model for 1 epoch.

Args:
    state_action_tensor: pytorch tensor with state-action expected_values.
    expected_values: pytorch tensor with expected values for each state-action.

Returns:
    The loss before trainig.
def _train(self, state_action_tensor, expected_values_tensor):
    'Train the model for 1 epoch.\n\n        Args:\n            state_action_tensor: pytorch tensor with state-action expected_values.\n            expected_values: pytorch tensor with expected values for each state-action.\n\n        Returns:\n            The loss before trainig.\n        '
    if (self.model is None):
        self._init_model(state_action_tensor.shape[1])
    self.optimizer.zero_grad()
    output = self.model(state_action_tensor)
    loss = self.criterion(output, expected_values_tensor)
    loss_value = loss.data.item()
    loss.backward()
    self.optimizer.step()
    return loss_value