class_docstr: A driver that takes N steps in an environment using a tf.while_loop.
  
  The while loop will run num_steps in the environment, only counting steps that
  result in an environment transition, i.e. (time_step, action, next_time_step).
  If a step results in environment resetting, i.e. time_step.is_last() and
  next_time_step.is_first() (traj.is_boundary()), this is not counted toward the
  num_steps.
  
  As environments run batched time_steps, the counters for all batch elements
  are summed, and execution stops when the total exceeds num_steps. When
  batch_size > 1, there is no guarantee that exactly num_steps are taken -- it
  may be more but never less.
  
  This termination condition can be overridden in subclasses by implementing the
  self._loop_condition_fn() method.
class_docstr_tok: ["A","driver","that","takes","N","steps","in","an","environment","using","a","tf.while_loop",".","The","while","loop","will","run","num_steps","in","the","environment",",","only","counting","steps","that","result","in","an","environment","transition",",","i.e",".","(","time_step",",","action",",","next_time_step",")",".","If","a","step","results","in","environment","resetting",",","i.e",".","time_step.is_last","(",")","and","next_time_step.is_first","(",")","(","traj.is_boundary","(",")",")",",","this","is","not","counted","toward","the","num_steps",".","As","environments","run","batched","time_steps",",","the","counters","for","all","batch","elements","are","summed",",","and","execution","stops","when","the","total","exceeds","num_steps",".","When","batch_size",">","1",",","there","is","no","guarantee","that","exactly","num_steps","are","taken","--","it","may","be","more","but","never","less",".","This","termination","condition","can","be","overridden","in","subclasses","by","implementing","the","self._loop_condition_fn","(",")","method","."]
docstr: Creates a DynamicStepDriver.
  
  Args:
    env: A tf_environment.Base environment.
    policy: A tf_policy.TFPolicy policy.
    observers: A list of observers that are updated after every step in the
      environment. Each observer is a callable(time_step.Trajectory).
    transition_observers: A list of observers that are updated after every
      step in the environment. Each observer is a callable((TimeStep,
      PolicyStep, NextTimeStep)).
    num_steps: The number of steps to take in the environment. For batched or
      parallel environments, this is the total number of steps taken summed
      across all environments.
  
  Raises:
    ValueError:
      If env is not a tf_environment.Base or policy is not an instance of
      tf_policy.TFPolicy.
docstr_tok: ["Creates","a","DynamicStepDriver",".","Args",":","env",":","A","tf_environment.Base","environment",".","policy",":","A","tf_policy.TFPolicy","policy",".","observers",":","A","list","of","observers","that","are","updated","after","every","step","in","the","environment",".","Each","observer","is","a","callable","(","time_step.Trajectory",")",".","transition_observers",":","A","list","of","observers","that","are","updated","after","every","step","in","the","environment",".","Each","observer","is","a","callable","(","(","TimeStep",",","PolicyStep",",","NextTimeStep",")",")",".","num_steps",":","The","number","of","steps","to","take","in","the","environment",".","For","batched","or","parallel","environments",",","this","is","the","total","number","of","steps","taken","summed","across","all","environments",".","Raises",":","ValueError",":","If","env","is","not","a","tf_environment.Base","or","policy","is","not","an","instance","of","tf_policy.TFPolicy","."]
code: def __init__(
      self,
      env,
      policy,
      observers=None,
      transition_observers=None,
      num_steps=1,
  ):
      """Creates a DynamicStepDriver.
  
      Args:
        env: A tf_environment.Base environment.
        policy: A tf_policy.TFPolicy policy.
        observers: A list of observers that are updated after every step in the
          environment. Each observer is a callable(time_step.Trajectory).
        transition_observers: A list of observers that are updated after every
          step in the environment. Each observer is a callable((TimeStep,
          PolicyStep, NextTimeStep)).
        num_steps: The number of steps to take in the environment. For batched or
          parallel environments, this is the total number of steps taken summed
          across all environments.
  
      Raises:
        ValueError:
          If env is not a tf_environment.Base or policy is not an instance of
          tf_policy.TFPolicy.
      """
      super(DynamicStepDriver, self).__init__(
          env, policy, observers, transition_observers
      )
      self._num_steps = num_steps
      self._run_fn = common.function_in_tf1(reduce_retracing=False)(
          self._run
      )
      self._is_bandit_env = is_bandit_env(env)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import gin
  import tensorflow
  from tf_agents.bandits.environments import bandit_py_environment
  from tf_agents.bandits.environments import bandit_tf_environment
  from tf_agents.drivers import driver
  from tf_agents.environments import tf_py_environment
  from tf_agents.environments import wrappers
  from tf_agents.trajectories import time_step
  from tf_agents.trajectories import trajectory
  from tf_agents.utils import common
  from tf_agents.utils import nest_utils
label_desc: Use image node_id 1 to create a new DynamicStepDriver object from inherited base classes: driver with example: obj = DynamicStepDriver(env, policy, observers, transition_observers, num_steps)