code: def call(self, on_policy):
      runner, model, buffer, steps = (
          self.runner,
          self.model,
          self.buffer,
          self.steps,
      )
      if on_policy:
          (
              enc_obs,
              obs,
              actions,
              rewards,
              mus,
              dones,
              masks,
          ) = runner.run()
          self.episode_stats.feed(rewards, dones)
          if buffer is not None:
              buffer.put(enc_obs, actions, rewards, mus, dones, masks)
      else:
          # get obs, actions, rewards, mus, dones from buffer.
          obs, actions, rewards, mus, dones, masks = buffer.get()
  
      # reshape stuff correctly
      obs = obs.reshape(runner.batch_ob_shape)
      actions = actions.reshape([runner.nbatch])
      rewards = rewards.reshape([runner.nbatch])
      mus = mus.reshape([runner.nbatch, runner.nact])
      dones = dones.reshape([runner.nbatch])
      masks = masks.reshape([runner.batch_ob_shape[0]])
  
      names_ops, values_ops = model.train(
          obs,
          actions,
          rewards,
          dones,
          mus,
          model.initial_state,
          masks,
          steps,
      )
  
      if on_policy and (
          int(steps / runner.nbatch) % self.log_interval == 0
      ):
          logger.record_tabular("total_timesteps", steps)
          logger.record_tabular(
              "fps", int(steps / (time.time() - self.tstart))
          )
          # IMP: In EpisodicLife env, during training, we get done=True at each loss of life, not just at the terminal state.
          # Thus, this is mean until end of life, not end of episode.
          # For true episode rewards, see the monitor files in the log folder.
          logger.record_tabular(
              "mean_episode_length", self.episode_stats.mean_length()
          )
          logger.record_tabular(
              "mean_episode_reward", self.episode_stats.mean_reward()
          )
          for name, val in zip(names_ops, values_ops):
              logger.record_tabular(name, float(val))
          logger.dump_tabular()
  
imports: import time
  import functools
  import numpy
  import tensorflow
  from baselines import logger
  from baselines.common import set_global_seeds
  from baselines.common.policies import build_policy
  from baselines.common.tf_util import get_session, save_variables, load_variables
  from baselines.common.vec_env.vec_frame_stack import VecFrameStack
  from baselines.a2c.utils import batch_to_seq, seq_to_batch
  from baselines.a2c.utils import cat_entropy_softmax
  from baselines.a2c.utils import Scheduler, find_trainable_variables
  from baselines.a2c.utils import EpisodeStats
  from baselines.a2c.utils import get_by_index, check_shape, avg_norm, gradient_add, q_explained_variance
  from baselines.acer.buffer import Buffer
  from baselines.acer.runner import Runner
label_desc: Use image node_id 2 for calling the Acer obj's underlying member method code with example usage: obj.call(on_policy) without return types