docstr: A runner to learn the policy of an environment for a model
  
  :param env: (Gym environment) The environment to learn from
  :param model: (Model) The model to learn
  :param n_steps: (int) The number of steps to run for each environment
docstr_tok: ["A","runner","to","learn","the","policy","of","an","environment","for","a","model",":","param","env",":","(","Gym","environment",")","The","environment","to","learn","from",":","param","model",":","(","Model",")","The","model","to","learn",":","param","n_steps",":","(","int",")","The","number","of","steps","to","run","for","each","environment"]
code: def __init__(self, env, model, n_steps):
      """
      A runner to learn the policy of an environment for a model
  
      :param env: (Gym environment) The environment to learn from
      :param model: (Model) The model to learn
      :param n_steps: (int) The number of steps to run for each environment
      """
  
      super(_Runner, self).__init__(
          env=env, model=model, n_steps=n_steps
      )
      self.env = env
      self.model = model
      self.n_env = n_env = env.num_envs
      if isinstance(env.action_space, Discrete):
          self.n_act = env.action_space.n
      else:
          self.n_act = env.action_space.shape[-1]
      self.n_batch = n_env * n_steps
  
      if len(env.observation_space.shape) > 1:
          self.raw_pixels = True
          (
              obs_height,
              obs_width,
              obs_num_channels,
          ) = env.observation_space.shape
          self.batch_ob_shape = (
              n_env * (n_steps + 1),
              obs_height,
              obs_width,
              obs_num_channels,
          )
          self.obs_dtype = np.uint8
          self.obs = np.zeros(
              (n_env, obs_height, obs_width, obs_num_channels),
              dtype=self.obs_dtype,
          )
          self.num_channels = obs_num_channels
      else:
          if len(env.observation_space.shape) == 1:
              self.obs_dim = env.observation_space.shape[0]
          else:
              self.obs_dim = 1
          self.raw_pixels = False
          if isinstance(self.env.observation_space, Discrete):
              self.batch_ob_shape = (n_env * (n_steps + 1),)
          else:
              self.batch_ob_shape = (
                  n_env * (n_steps + 1),
                  self.obs_dim,
              )
          self.obs_dtype = np.float32
  
      self.n_steps = n_steps
      self.states = model.initial_state
      self.dones = [False for _ in range(n_env)]
  
imports: import time
  import warnings
  import numpy
  import tensorflow
  from gym.spaces import Discrete, Box
  from collections import deque
  from stable_baselines import logger
  from stable_baselines.common.schedules import Scheduler
  from stable_baselines.common.tf_util import batch_to_seq, seq_to_batch, check_shape, avg_norm, gradient_add, q_explained_variance, total_episode_reward_logger
  from stable_baselines.acer.buffer import Buffer
  from stable_baselines.common import ActorCriticRLModel, tf_util, SetVerbosity, TensorboardWriter
  from stable_baselines.common.runners import AbstractEnvRunner
  from stable_baselines.common.policies import ActorCriticPolicy, RecurrentActorCriticPolicy
label_desc: Use image node_id 1 to create a new _Runner object from inherited base classes: AbstractEnvRunner with example: obj = _Runner(env, model, n_steps)