code: def do_test_explorations(
      config, dummy_obs, prev_a=None, expected_mean_action=None
  ):
      """Calls an Agent's `compute_actions` with different `explore` options."""
  
      # Test all frameworks.
      for _ in framework_iterator(config):
          print(f"Algorithm={config.algo_class}")
  
          # Test for both the default Agent's exploration AND the `Random`
          # exploration class.
          for exploration in [None, "Random"]:
              local_config = config.copy()
              if exploration == "Random":
                  if local_config._enable_new_api_stack:
                      # TODO(Artur): Support Random exploration with RL Modules.
                      continue
                  local_config.exploration(
                      exploration_config={"type": "Random"}
                  )
              print("exploration={}".format(exploration or "default"))
  
              algo = local_config.build()
  
              # Make sure all actions drawn are the same, given same
              # observations.
              actions = []
              for _ in range(25):
                  actions.append(
                      algo.compute_single_action(
                          observation=dummy_obs,
                          explore=False,
                          prev_action=prev_a,
                          prev_reward=1.0
                          if prev_a is not None
                          else None,
                      )
                  )
                  check(actions[-1], actions[0])
  
              # Make sure actions drawn are different
              # (around some mean value), given constant observations.
              actions = []
              for _ in range(500):
                  actions.append(
                      algo.compute_single_action(
                          observation=dummy_obs,
                          explore=True,
                          prev_action=prev_a,
                          prev_reward=1.0
                          if prev_a is not None
                          else None,
                      )
                  )
              check(
                  np.mean(actions),
                  expected_mean_action
                  if expected_mean_action is not None
                  else 0.5,
                  atol=0.4,
              )
              # Check that the stddev is not 0.0 (values differ).
              check(np.std(actions), 0.0, false=True)
  
file_path: ray/rllib/utils/exploration/tests/test_explorations.py
imports: import numpy
  import sys
  import unittest
  import ray
  import ray.rllib.algorithms.dqn
  import ray.rllib.algorithms.impala
  import ray.rllib.algorithms.ppo
  import ray.rllib.algorithms.sac
  from ray.rllib.utils import check, framework_iterator
label_desc: Use image node_id 1 for calling a global function with example usage: do_test_explorations(config, dummy_obs, prev_a, expected_mean_action) without return types