code: def test_report_and_load_using_ml_session(ray_start_4_cpus):
      def train_func():
          checkpoint = train.get_checkpoint()
          if checkpoint:
              with checkpoint.as_directory() as checkpoint_dir:
                  import tensorflow as tf
  
                  model = tf.keras.models.load_model(checkpoint_dir)
          else:
              model = build_model()
  
          if train.get_context().get_world_rank() == 0:
              with tempfile.TemporaryDirectory() as tmp_dir:
                  model.save(tmp_dir)
                  train.report(
                      metrics={"iter": 1},
                      checkpoint=TensorflowCheckpoint.from_saved_model(
                          tmp_dir
                      ),
                  )
          else:
              train.report(metrics={"iter": 1})
  
      scaling_config = ScalingConfig(num_workers=2)
      trainer = TensorflowTrainer(
          train_loop_per_worker=train_func,
          scaling_config=scaling_config,
      )
      result = trainer.fit()
      checkpoint = result.checkpoint
  
      trainer2 = TensorflowTrainer(
          train_loop_per_worker=train_func,
          scaling_config=scaling_config,
          resume_from_checkpoint=checkpoint,
      )
      result = trainer2.fit()
      checkpoint = result.checkpoint
      with checkpoint.as_directory() as ckpt_dir:
          assert os.path.exists(
              os.path.join(ckpt_dir, "saved_model.pb")
          )
      assert result.metrics["iter"] == 1
  
file_path: ray/python/ray/train/tests/test_tensorflow_trainer.py
imports: import os
  import tempfile
  import pytest
  import ray
  from ray import train
  from ray.data.preprocessors import Concatenator
  from ray.train import ScalingConfig
  from ray.train.constants import TRAIN_DATASET_KEY
  from ray.train.examples.tf.tensorflow_regression_example import train_func
  from ray.train.tensorflow import TensorflowCheckpoint, TensorflowTrainer
label_desc: Use image node_id 4 for calling a global function with example usage: test_report_and_load_using_ml_session(ray_start_4_cpus) without return types