def METHOD_NAME(self, rewards, dones, actions, observations, next_obs, index):
    """
    Update the single agent neural networks, called by update_net.
    :param rewards: reward list of the sampled buffer
    :param dones: done list of the sampled buffer
    :param actions: action list of the sampled buffer
    :param observations: observation list of the sampled buffer
    :param next_obs: next_observation list of the sample buffer
    :param index: ID of the agent
    """
    curr_agent = self.agents[index]
    curr_agent.cri_optim.zero_grad()
    all_target_actions = []
    for i in range(self.n_agents):
        if i == index:
            all_target_actions.append(curr_agent.act_target(next_obs[:, index]))
        if i != index:
            action = self.agents[i].act_target(next_obs[:, i])
            all_target_actions.append(action)
    action_target_all = (
        torch.cat(all_target_actions, dim=1)
        .to(self.device)
        .reshape(actions.shape[0], actions.shape[1] * actions.shape[2])
    )
    target_value = rewards[:, index] + self.gamma * curr_agent.cri_target(
        next_obs.reshape(next_obs.shape[0], next_obs.shape[1] * next_obs.shape[2]),
        action_target_all,
    ).detach().squeeze(dim=1)
    actual_value = curr_agent.cri(
        observations.reshape(
            next_obs.shape[0], next_obs.shape[1] * next_obs.shape[2]
        ),
        actions.reshape(actions.shape[0], actions.shape[1] * actions.shape[2]),
    ).squeeze(dim=1)
    vf_loss = curr_agent.loss_td(actual_value, target_value.detach())
    curr_agent.act_optim.zero_grad()
    curr_pol_out = curr_agent.act(observations[:, index])
    curr_pol_vf_in = curr_pol_out
    all_pol_acs = []
    for i in range(self.n_agents):
        if i == index:
            all_pol_acs.append(curr_pol_vf_in)
        else:
            all_pol_acs.append(actions[:, i])
    pol_loss = -torch.mean(
        curr_agent.cri(
            observations.reshape(
                observations.shape[0], observations.shape[1] * observations.shape[2]
            ),
            torch.cat(all_pol_acs, dim=1)
            .to(self.device)
            .reshape(actions.shape[0], actions.shape[1] * actions.shape[2]),
        )
    )
    curr_agent.act_optim.zero_grad()
    pol_loss.backward()
    curr_agent.act_optim.step()
    curr_agent.cri_optim.zero_grad()
    vf_loss.backward()
    curr_agent.cri_optim.step()