code: def sample(self):
      env_sample_data = {}
      for env_id in range(self.config["env_num"]):
          env_sample_data[env_id] = defaultdict(list)
  
      for i in range(self.config["sample_batch_steps"]):
          actions, behaviour_logits = self.agent.sample(
              np.stack(self.obs_batch)
          )
          (
              next_obs_batch,
              reward_batch,
              done_batch,
              info_batch,
          ) = self.vector_env.step(actions)
  
          for env_id in range(self.config["env_num"]):
              env_sample_data[env_id]["obs"].append(
                  self.obs_batch[env_id]
              )
              env_sample_data[env_id]["actions"].append(actions[env_id])
              env_sample_data[env_id]["behaviour_logits"].append(
                  behaviour_logits[env_id]
              )
              env_sample_data[env_id]["rewards"].append(
                  reward_batch[env_id]
              )
              env_sample_data[env_id]["dones"].append(
                  done_batch[env_id]
              )
  
          self.obs_batch = next_obs_batch
  
      # Merge data of envs
      sample_data = defaultdict(list)
      for env_id in range(self.config["env_num"]):
          for data_name in [
              "obs",
              "actions",
              "behaviour_logits",
              "rewards",
              "dones",
          ]:
              sample_data[data_name].extend(
                  env_sample_data[env_id][data_name]
              )
  
      # size of sample_data: env_num * sample_batch_steps
      for key in sample_data:
          sample_data[key] = np.stack(sample_data[key])
  
      return sample_data
  
file_path: PARL/benchmark/fluid/IMPALA/actor.py
imports: import gym
  import numpy
  import parl
  import six
  import parl
  from atari_model import AtariModel
  from collections import defaultdict
  from atari_agent import AtariAgent
  from parl.env.atari_wrappers import wrap_deepmind, MonitorEnv, get_wrapper_by_cls
  from parl.env.vector_env import VectorEnv
label_desc: Use image node_id 2 for calling the Actor obj's underlying member method code with example usage: obj.sample() and returns: sample_data