class_docstr: DQN from https://arxiv.org/pdf/1312.5602.pdf.
  
  Known as Deep Q-Network, it estimates the Q-value function by deep neural
  networks. It enables Q-Learning to be applied on high complexity
  environments. To deal with pixel environments, numbers of tricks are
  usually needed, e.g. skipping frames and stacking frames as single
  observation.
  
  Args:
      env_spec (EnvSpec): Environment specification.
      policy (Policy): Policy.
      qf (object): The q value network.
      replay_buffer (ReplayBuffer): Replay buffer.
      sampler (garage.sampler.Sampler): Sampler.
      exploration_policy (ExplorationPolicy): Exploration strategy.
      steps_per_epoch (int): Number of train_once calls per epoch.
      min_buffer_size (int): The minimum buffer size for replay buffer.
      buffer_batch_size (int): Batch size for replay buffer.
      max_episode_length_eval (int or None): Maximum length of episodes used
          for off-policy evaluation. If None, defaults to
          `env_spec.max_episode_length`.
      n_train_steps (int): Training steps.
      qf_lr (float): Learning rate for Q-Function.
      qf_optimizer (tf.compat.v1.train.Optimizer): Optimizer for Q-Function.
      discount (float): Discount factor for rewards.
      target_network_update_freq (int): Frequency of updating target
          network.
      grad_norm_clipping (float): Maximum clipping value for clipping
          tensor values to a maximum L2-norm. It must be larger than 0.
          If None, no gradient clipping is done. For detail, see
          docstring for tf.clip_by_norm.
      double_q (bool): Bool for using double q-network.
      reward_scale (float): Reward scale.
      name (str): Name of the algorithm.
class_docstr_tok: ["DQN","from","https",":","\/\/arxiv.org\/pdf\/1312.5602.pdf",".","Known","as","Deep","Q-Network",",","it","estimates","the","Q-value","function","by","deep","neural","networks",".","It","enables","Q-Learning","to","be","applied","on","high","complexity","environments",".","To","deal","with","pixel","environments",",","numbers","of","tricks","are","usually","needed",",","e.g",".","skipping","frames","and","stacking","frames","as","single","observation",".","Args",":","env_spec","(","EnvSpec",")",":","Environment","specification",".","policy","(","Policy",")",":","Policy",".","qf","(","object",")",":","The","q","value","network",".","replay_buffer","(","ReplayBuffer",")",":","Replay","buffer",".","sampler","(","garage.sampler.Sampler",")",":","Sampler",".","exploration_policy","(","ExplorationPolicy",")",":","Exploration","strategy",".","steps_per_epoch","(","int",")",":","Number","of","train_once","calls","per","epoch",".","min_buffer_size","(","int",")",":","The","minimum","buffer","size","for","replay","buffer",".","buffer_batch_size","(","int",")",":","Batch","size","for","replay","buffer",".","max_episode_length_eval","(","int","or","None",")",":","Maximum","length","of","episodes","used","for","off-policy","evaluation",".","If","None",",","defaults","to","`","env_spec.max_episode_length","`",".","n_train_steps","(","int",")",":","Training","steps",".","qf_lr","(","float",")",":","Learning","rate","for","Q-Function",".","qf_optimizer","(","tf.compat.v1.train.Optimizer",")",":","Optimizer","for","Q-Function",".","discount","(","float",")",":","Discount","factor","for","rewards",".","target_network_update_freq","(","int",")",":","Frequency","of","updating","target","network",".","grad_norm_clipping","(","float",")",":","Maximum","clipping","value","for","clipping","tensor","values","to","a","maximum","L2-norm",".","It","must","be","larger","than","0",".","If","None",",","no","gradient","clipping","is","done",".","For","detail",",","see","docstring","for","tf.clip_by_norm",".","double_q","(","bool",")",":","Bool","for","using","double","q-network",".","reward_scale","(","float",")",":","Reward","scale",".","name","(","str",")",":","Name","of","the","algorithm","."]
code: def __init__(
      self,
      env_spec,
      policy,
      qf,
      replay_buffer,
      sampler,
      exploration_policy=None,
      steps_per_epoch=20,
      min_buffer_size=int(1e4),
      buffer_batch_size=64,
      max_episode_length_eval=None,
      n_train_steps=50,
      qf_lr=0.001,
      qf_optimizer=tf.compat.v1.train.AdamOptimizer,
      discount=1.0,
      target_network_update_freq=5,
      grad_norm_clipping=None,
      double_q=False,
      reward_scale=1.0,
      name="DQN",
  ):
      self._qf_optimizer = qf_optimizer
      self._qf_lr = qf_lr
      self._name = name
      self._target_network_update_freq = target_network_update_freq
      self._grad_norm_clipping = grad_norm_clipping
      self._double_q = double_q
  
      # clone a target q-function
      self._target_qf = qf.clone("target_qf")
  
      self._min_buffer_size = min_buffer_size
      self._qf = qf
      self._steps_per_epoch = steps_per_epoch
      self._n_train_steps = n_train_steps
      self._buffer_batch_size = buffer_batch_size
      self._discount = discount
      self._reward_scale = reward_scale
      self.max_episode_length = env_spec.max_episode_length
      self._max_episode_length_eval = env_spec.max_episode_length
  
      if max_episode_length_eval is not None:
          self._max_episode_length_eval = max_episode_length_eval
  
      self._eval_env = None
  
      self._env_spec = env_spec
      self._replay_buffer = replay_buffer
      self.policy = policy
      self.exploration_policy = exploration_policy
  
      self._sampler = sampler
  
      self._init_opt()
  
file_path: garage/src/garage/tf/algos/dqn.py
imports: import akro
  from dowel import tabular
  import numpy
  import tensorflow
  from garage import log_performance, make_optimizer, obtain_evaluation_episodes
  from garage.np.algos import RLAlgorithm
  from garage.tf import compile_function, get_target_ops
label_desc: Use image node_id 1 to create a new DQN object from inherited base classes: RLAlgorithm with example: obj = DQN(env_spec, policy, qf, replay_buffer, sampler, exploration_policy, steps_per_epoch, min_buffer_size, buffer_batch_size, max_episode_length_eval, n_train_steps, qf_lr, qf_optimizer, discount, target_network_update_freq, grad_norm_clipping, double_q, reward_scale, name)