class_docstr: Generates trials to be passed to the TrialRunner.
  
  Uses the provided ``searcher`` object to generate trials. This class
  transparently handles repeating trials with score aggregation
  without embedding logic into the Searcher.
  
  Args:
      searcher: Search object that subclasses the Searcher base class. This
          is then used for generating new hyperparameter samples.
docstr: Saves self + searcher to dir.
  
  Separates the "searcher" from its wrappers (concurrency, repeating).
  This allows the user to easily restore a given searcher.
  
  The save operation is atomic (write/swap).
  
  Args:
      dirpath: Filepath to experiment dir.
      session_str: Unique identifier of the current run
          session.
docstr_tok: ["Saves","self","+","searcher","to","dir",".","Separates","the","``","searcher","''","from","its","wrappers","(","concurrency",",","repeating",")",".","This","allows","the","user","to","easily","restore","a","given","searcher",".","The","save","operation","is","atomic","(","write\/swap",")",".","Args",":","dirpath",":","Filepath","to","experiment","dir",".","session_str",":","Unique","identifier","of","the","current","run","session","."]
code: def save_to_dir(self, dirpath: str, session_str: str):
      """Saves self + searcher to dir.
  
      Separates the "searcher" from its wrappers (concurrency, repeating).
      This allows the user to easily restore a given searcher.
  
      The save operation is atomic (write/swap).
  
      Args:
          dirpath: Filepath to experiment dir.
          session_str: Unique identifier of the current run
              session.
      """
      searcher = self.searcher
      search_alg_state = self.get_state()
      while hasattr(searcher, "searcher"):
          searcher_name = type(searcher).__name__
          if searcher_name in search_alg_state:
              logger.warning(
                  "There was a duplicate when saving {}. "
                  "Restore may not work properly.".format(searcher_name)
              )
          else:
              search_alg_state[
                  "name:" + searcher_name
              ] = searcher.get_state()
          searcher = searcher.searcher
      base_searcher = searcher
      # We save the base searcher separately for users to easily
      # separate the searcher.
      base_searcher.save_to_dir(dirpath, session_str)
      _atomic_save(
          state=search_alg_state,
          checkpoint_dir=dirpath,
          file_name=self.CKPT_FILE_TMPL.format(session_str),
          tmp_file_name=".tmp_search_generator_ckpt",
      )
  
imports: import copy
  import logging
  from typing import Dict, List, Optional, Union
  from ray.tune.error import TuneError
  from ray.tune.experiment import Experiment, _convert_to_experiment_list
  from ray.tune.experiment.config_parser import _make_parser, _create_trial_from_spec
  from ray.tune.search.search_algorithm import SearchAlgorithm
  from ray.tune.search import Searcher
  from ray.tune.search.util import _set_search_properties_backwards_compatible
  from ray.tune.search.variant_generator import format_vars, _resolve_nested_dict
  from ray.tune.experiment import Trial
  from ray.tune.utils.util import flatten_dict, merge_dicts, _atomic_save, _load_newest_checkpoint
  from ray.util.annotations import DeveloperAPI
label_desc: Use image node_id 14 for calling the SearchGenerator obj's underlying member method code with example usage: obj.save_to_dir(dirpath, session_str) without return types