class_docstr: Targeted at testing functions of built-in tuners, including
      - [ ] load_checkpoint
      - [ ] save_checkpoint
      - [X] update_search_space
      - [X] generate_multiple_parameters
      - [X] import_data
      - [ ] trial_end
      - [x] receive_trial_result
class_docstr_tok: ["Targeted","at","testing","functions","of","built-in","tuners",",","including","-","[","]","load_checkpoint","-","[","]","save_checkpoint","-","[","X","]","update_search_space","-","[","X","]","generate_multiple_parameters","-","[","X","]","import_data","-","[","]","trial_end","-","[","x","]","receive_trial_result"]
code: def check_range(self, generated_params, search_space):
      EPS = 1e-6
      for param in generated_params:
          if self._testMethodName == "test_batch":
              param = {list(search_space.keys())[0]: param}
          for k, v in param.items():
              if (
                  k == "load_checkpoint_dir"
                  or k == "save_checkpoint_dir"
              ):
                  self.assertIsInstance(v, str)
                  continue
              if k.startswith("_mutable_layer"):
                  _, block, layer, choice = k.split("/")
                  cand = search_space[block]["_value"][layer].get(
                      choice
                  )
                  # cand could be None, e.g., optional_inputs_chosen_state
                  if choice == "layer_choice":
                      self.assertIn(v, cand)
                  if choice == "optional_input_size":
                      if isinstance(cand, int):
                          self.assertEqual(v, cand)
                      else:
                          self.assertGreaterEqual(v, cand[0])
                          self.assertLessEqual(v, cand[1])
                  if choice == "optional_inputs":
                      pass  # ignore for now
                  continue
              item = search_space[k]
              if item["_type"] == "choice":
                  self.assertIn(v, item["_value"])
              if item["_type"] == "randint":
                  self.assertIsInstance(v, int)
              if item["_type"] == "uniform":
                  self.assertIsInstance(v, float)
              if item["_type"] in (
                  "randint",
                  "uniform",
                  "quniform",
                  "loguniform",
                  "qloguniform",
              ):
                  self.assertGreaterEqual(v, item["_value"][0])
                  self.assertLessEqual(v, item["_value"][1])
              if item["_type"].startswith("q"):
                  multiple = v / item["_value"][2]
                  print(k, v, multiple, item)
                  if (
                      item["_value"][0] + EPS
                      < v
                      < item["_value"][1] - EPS
                  ):
                      self.assertAlmostEqual(
                          int(round(multiple)), multiple
                      )
              if item["_type"] in ("qlognormal", "lognormal"):
                  self.assertGreaterEqual(v, 0)
              if item["_type"] == "mutable_layer":
                  for layer_name in item["_value"].keys():
                      self.assertIn(
                          v[layer_name]["chosen_layer"],
                          item["layer_choice"],
                      )
  
imports: import glob
  import json
  import logging
  import os
  import random
  import shutil
  import sys
  from collections import deque
  from unittest import TestCase, main
  from nni.algorithms.hpo.batch_tuner import BatchTuner
  from nni.algorithms.hpo.dngo_tuner import DNGOTuner
  from nni.algorithms.hpo.evolution_tuner import EvolutionTuner
  from nni.algorithms.hpo.gp_tuner import GPTuner
  from nni.algorithms.hpo.gridsearch_tuner import GridSearchTuner
  from nni.algorithms.hpo.hyperopt_tuner import HyperoptTuner
  from nni.algorithms.hpo.metis_tuner import MetisTuner
  from nni.algorithms.hpo.pbt_tuner import PBTTuner
  from nni.algorithms.hpo.random_tuner import RandomTuner
  from nni.algorithms.hpo.regularized_evolution_tuner import RegularizedEvolutionTuner
  from nni.algorithms.hpo.tpe_tuner import TpeTuner
  from nni.runtime.msg_dispatcher import _pack_parameter, MsgDispatcher
  from nni.tuner import Tuner
label_desc: Use image node_id 5 for calling the BuiltinTunersTestCase obj's underlying member method code with example usage: obj.check_range(generated_params, search_space) without return types