docstr: o(t)_a, s(t), u(t)_-a, u(t-1), agent_id
          
docstr_tok: ["o","(","t",")","_a",",","s","(","t",")",",","u","(","t",")","_-a",",","u","(","t-1",")",",","agent_id"]
code: def _get_critic_inputs(self, batch):
      """o(t)_a, s(t), u(t)_-a, u(t-1), agent_id"""
      ep_num = batch["o"].shape[0]
      tr_num = batch["o"].shape[1]
  
      # o, o_next, state, state_next
      o = batch["o"]  # shape (ep_num, tr_num, n_agents, obs_shape)
      o_next = np.zeros_like(o)
      o_next[:, :-1] = o[:, 1:]
      s = batch["s"]  # shape (ep_num, tr_num, state_shape)
      s_next = np.zeros_like(s)
      s_next[:, :-1] = s[:, 1:]
      # u_onehot, u_onehot_last shape (ep_num, tr_num, n_agents, n_actions)
      u_onehot = batch["u_onehot"]
      u_onehot_next = np.zeros_like(u_onehot)
      u_onehot_next[:, :-1] = u_onehot[:, 1:]
      u_onehot_last = np.zeros_like(u_onehot)
      u_onehot_last[:, 1:] = u_onehot[:, :-1]
  
      critic_inputs = []
      critic_inputs_next = []
      for agent_id in range(self.n_agents):
          # get o(t)_a, s(t)
          o_a = o[:, :, agent_id]  # shape (ep_num, tr_num, obs_shape)
          o_a_next = o_next[:, :, agent_id]
          s_a = s  # shape (ep_num, tr_num, state_shape)
          s_a_next = s_next
          # get u(t-1)  shape (ep_num, tr_num, n_agents * n_actions)
          u_all_onehot = u_onehot.reshape(
              (ep_num, tr_num, self.n_agents * self.n_actions)
          )
          u_all_onehot_next = u_onehot_next.reshape(
              (ep_num, tr_num, self.n_agents * self.n_actions)
          )
          u_all_onehot_last = u_onehot_last.reshape(
              (ep_num, tr_num, self.n_agents * self.n_actions)
          )
          # get u(t)_-a,   set 0 to mask action, shape (ep_num, tr_num, n_agents * n_actions)
          u_not_a_onehot = u_all_onehot.copy()
          u_not_a_onehot_next = u_all_onehot_next.copy()
          m_s = agent_id * self.n_actions  # mask start flag
          m_e = (agent_id + 1) * self.n_actions  # mask end flag
          u_not_a_onehot[:, :, m_s:m_e] = 0
          u_not_a_onehot_next[:, :, m_s:m_e] = 0
          # get id onehot, shape (ep_num, tr_num, n_agents)
          id_onehot = np.zeros((ep_num, tr_num, self.n_agents))
          id_onehot[:, :, agent_id] = 1.0
  
          # input:      o,      s,      u_-a,      u_last, agent_id
          # input_next: o_next, s_next, u_-a_next, u,      agent_id
          # shape (ep_num, tr_num, critic_input_dim)
          c_inputs = np.concatenate(
              (o_a, s_a, u_not_a_onehot, u_all_onehot_last, id_onehot),
              axis=2,
          )
          c_inputs_next = np.concatenate(
              (
                  o_a_next,
                  s_a_next,
                  u_not_a_onehot_next,
                  u_all_onehot,
                  id_onehot,
              ),
              axis=2,
          )
          critic_inputs.append(c_inputs)
          critic_inputs_next.append(c_inputs_next)
      critic_inputs = np.stack(critic_inputs, axis=2)
      critic_inputs_next = np.stack(critic_inputs_next, axis=2)
      # shape (ep_num, tr_num, n_agents, critic_input_dim)
      return critic_inputs, critic_inputs_next
  
file_path: PARL/benchmark/torch/coma/sc2_agent.py
imports: import numpy
  import parl
  import torch
  from torch.distributions import Categorical
label_desc: Use image node_id 6 for calling the Agents obj's underlying member method code with example usage: obj._get_critic_inputs(batch) and returns: critic_inputs,  critic_inputs_next