code: def tune_mnist(num_training_iterations):
      sched = AsyncHyperBandScheduler(
          time_attr="training_iteration", max_t=400, grace_period=20
      )
  
      tuner = tune.Tuner(
          tune.with_resources(
              train_mnist, resources={"cpu": 2, "gpu": 0}
          ),
          run_config=train.RunConfig(
              name="exp",
              stop={
                  "mean_accuracy": 0.99,
                  "training_iteration": num_training_iterations,
              },
          ),
          tune_config=tune.TuneConfig(
              scheduler=sched,
              metric="mean_accuracy",
              mode="max",
              num_samples=10,
          ),
          param_space={
              "threads": 2,
              "lr": tune.uniform(0.001, 0.1),
              "momentum": tune.uniform(0.1, 0.9),
              "hidden": tune.randint(32, 512),
          },
      )
      results = tuner.fit()
      print(
          "Best hyperparameters found were: ",
          results.get_best_result().config,
      )
  
file_path: ray/python/ray/tune/examples/tune_mnist_keras.py
imports: import argparse
  import os
  from filelock import FileLock
  from tensorflow.keras.datasets import mnist
  import ray
  from ray import train, tune
  from ray.tune.schedulers import AsyncHyperBandScheduler
  from ray.air.integrations.keras import ReportCheckpointCallback
label_desc: Use image node_id 2 for calling a global function with example usage: tune_mnist(num_training_iterations) without return types