class_docstr: Defines a configuration class from which a DQN Algorithm can be built.
  
  .. testcode::
  
      from ray.rllib.algorithms.dqn.dqn import DQNConfig
      config = DQNConfig()
  
      replay_config = {
              "type": "MultiAgentPrioritizedReplayBuffer",
              "capacity": 60000,
              "prioritized_replay_alpha": 0.5,
              "prioritized_replay_beta": 0.5,
              "prioritized_replay_eps": 3e-6,
          }
  
      config = config.training(replay_buffer_config=replay_config)
      config = config.resources(num_gpus=0)
      config = config.rollouts(num_rollout_workers=1)
      config = config.environment("CartPole-v1")
      algo = DQN(config=config)
      algo.train()
      del algo
  
  .. testcode::
  
      from ray.rllib.algorithms.dqn.dqn import DQNConfig
      from ray import air
      from ray import tune
      config = DQNConfig()
      config = config.training(
          num_atoms=tune.grid_search([1,]))
      config = config.environment(env="CartPole-v1")
      tune.Tuner(
          "DQN",
          run_config=air.RunConfig(stop={"training_iteration":1}),
          param_space=config.to_dict()
      ).fit()
  
  .. testoutput::
      :hide:
  
      ...
class_docstr_tok: ["Defines","a","configuration","class","from","which","a","DQN","Algorithm","can","be","built",".","..","testcode",":",":","from","ray.rllib.algorithms.dqn.dqn","import","DQNConfig","config","=","DQNConfig","(",")","replay_config","=","{","``","type","''",":","``","MultiAgentPrioritizedReplayBuffer","''",",","``","capacity","''",":","60000",",","``","prioritized_replay_alpha","''",":","0.5",",","``","prioritized_replay_beta","''",":","0.5",",","``","prioritized_replay_eps","''",":","3e-6",",","}","config","=","config.training","(","replay_buffer_config=replay_config",")","config","=","config.resources","(","num_gpus=0",")","config","=","config.rollouts","(","num_rollout_workers=1",")","config","=","config.environment","(","``","CartPole-v1","''",")","algo","=","DQN","(","config=config",")","algo.train","(",")","del","algo","..","testcode",":",":","from","ray.rllib.algorithms.dqn.dqn","import","DQNConfig","from","ray","import","air","from","ray","import","tune","config","=","DQNConfig","(",")","config","=","config.training","(","num_atoms=tune.grid_search","(","[","1",",","]",")",")","config","=","config.environment","(","env=","''","CartPole-v1","''",")","tune.Tuner","(","``","DQN","''",",","run_config=air.RunConfig","(","stop=","{","``","training_iteration","''",":1","}",")",",","param_space=config.to_dict","(",")",")",".fit","(",")","..","testoutput",":",":",":","hide",":","..."]
code: def validate(self) -> None:
      # Call super's validation method.
      super().validate()
  
      if self.td_error_loss_fn not in ["huber", "mse"]:
          raise ValueError(
              "`td_error_loss_fn` must be 'huber' or 'mse'!"
          )
  
      # Check rollout_fragment_length to be compatible with n_step.
      if (
          not self.in_evaluation
          and self.rollout_fragment_length != "auto"
          and self.rollout_fragment_length < self.n_step
      ):
          raise ValueError(
              f"Your `rollout_fragment_length` ({self.rollout_fragment_length}) is "
              f"smaller than `n_step` ({self.n_step})! "
              f"Try setting config.rollouts(rollout_fragment_length={self.n_step})."
          )
  
      if self.exploration_config["type"] == "ParameterNoise":
          if self.batch_mode != "complete_episodes":
              raise ValueError(
                  "ParameterNoise Exploration requires `batch_mode` to be "
                  "'complete_episodes'. Try setting `config.rollouts("
                  "batch_mode='complete_episodes')`."
              )
          if self.noisy:
              raise ValueError(
                  "ParameterNoise Exploration and `noisy` network cannot be"
                  " used at the same time!"
              )
  
imports: import logging
  from typing import List, Optional, Type, Callable
  import numpy
  from ray.rllib.algorithms.algorithm_config import AlgorithmConfig, NotProvided
  from ray.rllib.algorithms.dqn.dqn_tf_policy import DQNTFPolicy
  from ray.rllib.algorithms.dqn.dqn_torch_policy import DQNTorchPolicy
  from ray.rllib.algorithms.simple_q.simple_q import SimpleQ, SimpleQConfig
  from ray.rllib.execution.rollout_ops import synchronous_parallel_sample
  from ray.rllib.policy.sample_batch import MultiAgentBatch
  from ray.rllib.execution.train_ops import train_one_step, multi_gpu_train_one_step
  from ray.rllib.policy.policy import Policy
  from ray.rllib.utils.annotations import override
  from ray.rllib.utils.replay_buffers.utils import update_priorities_in_replay_buffer
  from ray.rllib.utils.typing import ResultDict
  from ray.rllib.utils.metrics import LAST_TARGET_UPDATE_TS, NUM_AGENT_STEPS_SAMPLED, NUM_ENV_STEPS_SAMPLED, NUM_TARGET_UPDATES, SAMPLE_TIMER, SYNCH_WORKER_WEIGHTS_TIMER
  from ray.rllib.utils.deprecation import DEPRECATED_VALUE
  from ray.rllib.utils.replay_buffers.utils import sample_min_n_steps_from_buffer
label_desc: Use image node_id 3 for calling the DQNConfig obj's underlying member method code with example usage: obj.validate() without return types