code: def run_all(logdir, verbose=False):
    
    data = prepare_data()
    rng = random.Random(0)
  
    base_writer = tf.summary.create_file_writer(logdir)
    with base_writer.as_default():
      experiment = hp.Experiment(hparams=HPARAMS, metrics=METRICS)
      experiment_string = experiment.summary_pb().SerializeToString()
      tf.summary.experimental.write_raw_pb(experiment_string, step=0)
      base_writer.flush()
    base_writer.close()
  
    sessions_per_group = 2
    num_sessions = flags.FLAGS.num_session_groups * sessions_per_group
    session_index = 0  # across all session groups
    for group_index in xrange(flags.FLAGS.num_session_groups):
      hparams = {h: sample_uniform(h.domain, rng) for h in HPARAMS}
      hparams_string = str(hparams)
      group_id = hashlib.sha256(hparams_string.encode("utf-8")).hexdigest()
      for repeat_index in xrange(sessions_per_group):
        session_id = str(session_index)
        session_index += 1
        if verbose:
          print(
              "--- Running training session %d/%d"
              % (session_index, num_sessions)
          )
          print(hparams_string)
          print("--- repeat #: %d" % (repeat_index + 1))
        run(
            data=data,
            base_logdir=logdir,
            session_id=session_id,
            group_id=group_id,
            hparams=hparams,
        )
docs: Perform random search over the hyperparameter space.
  
    Arguments:
      logdir: The top-level directory into which to write data. This
        directory should be empty or nonexistent.
      verbose: If true, print out each run's name as it begins.