code: def tune_tensorflow_mnist(
      num_workers: int = 2, num_samples: int = 2, use_gpu: bool = False
  ):
      trainer = TensorflowTrainer(
          train_loop_per_worker=train_func,
          scaling_config=ScalingConfig(
              num_workers=num_workers, use_gpu=use_gpu
          ),
      )
      tuner = Tuner(
          trainer,
          tune_config=TuneConfig(
              num_samples=num_samples, metric="accuracy", mode="max"
          ),
          param_space={
              "train_loop_config": {
                  "lr": tune.loguniform(1e-4, 1e-1),
                  "batch_size": tune.choice([32, 64, 128]),
                  "epochs": 3,
              }
          },
      )
      best_accuracy = tuner.fit().get_best_result().metrics["accuracy"]
      print(f"Best accuracy config: {best_accuracy}")
  
file_path: ray/python/ray/train/examples/tf/tune_tensorflow_mnist_example.py
imports: import argparse
  import ray
  from ray import tune
  from ray.train import ScalingConfig
  from ray.train.examples.tf.tensorflow_mnist_example import train_func
  from ray.train.tensorflow import TensorflowTrainer
  from ray.tune.tune_config import TuneConfig
  from ray.tune.tuner import Tuner
label_desc: Use image node_id 1 for calling a global function with example usage: tune_tensorflow_mnist(num_workers, num_samples, use_gpu) without return types