docstr: Test whether APEXDQN can be built on all frameworks.
docstr_tok: ["Test","whether","APEXDQN","can","be","built","on","all","frameworks","."]
code: def test_apex_dqn_compilation_and_per_worker_epsilon_values(self):
      """Test whether APEXDQN can be built on all frameworks."""
      config = (
          ApexDQNConfig()
          .environment("CartPole-v1")
          .rollouts(num_rollout_workers=3)
          .resources(num_gpus=0)
          .training(
              num_steps_sampled_before_learning_starts=0,
              optimizer={
                  "num_replay_buffer_shards": 1,
              },
          )
          .reporting(
              min_sample_timesteps_per_iteration=100,
              min_time_s_per_iteration=1,
          )
      )
  
      for _ in framework_iterator(config, with_eager_tracing=True):
          algo = config.build()
  
          # Test per-worker epsilon distribution.
          infos = algo.workers.foreach_policy(
              lambda p, _: p.get_exploration_state()
          )
          expected = [0.4, 0.016190862, 0.00065536]
          check([i["cur_epsilon"] for i in infos], [0.0] + expected)
  
          check_compute_single_action(algo)
  
          for i in range(2):
              results = algo.train()
              check_train_results(results)
              print(results)
  
          # Test again per-worker epsilon distribution
          # (should not have changed).
          infos = algo.workers.foreach_policy(
              lambda p, _: p.get_exploration_state()
          )
          check([i["cur_epsilon"] for i in infos], [0.0] + expected)
  
          algo.stop()
  
file_path: ray/rllib_contrib/apex_dqn/tests/test_apex_dqn.py
imports: import unittest
  import pytest
  from rllib_apex_dqn.apex_dqn.apex_dqn import ApexDQNConfig
  import ray
  from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID
  from ray.rllib.utils.metrics.learner_info import LEARNER_INFO, LEARNER_STATS_KEY
  from ray.rllib.utils.test_utils import check, check_compute_single_action, check_train_results, framework_iterator
label_desc: Use image node_id 4 for calling the TestApexDQN obj's underlying member method code with example usage: obj.test_apex_dqn_compilation_and_per_worker_epsilon_values() without return types