code: def test_save_load_model_h5(self):
      sc = OrcaContext.get_spark_context()
      rdd = sc.range(0, 100)
      spark = OrcaContext.get_spark_session()
  
      from pyspark.ml.linalg import DenseVector
  
      df = rdd.map(
          lambda x: (
              DenseVector(
                  np.random.randn(
                      1,
                  ).astype(np.float32)
              ),
              int(np.random.randint(0, 2, size=())),
          )
      ).toDF(["feature", "label"])
  
      config = {"lr": 0.2}
  
      try:
          temp_dir = tempfile.mkdtemp()
  
          trainer = Estimator.from_keras(
              model_creator=model_creator,
              verbose=True,
              config=config,
              workers_per_node=3,
              backend="ray",
          )
  
          res = trainer.fit(
              df,
              epochs=5,
              batch_size=4,
              steps_per_epoch=25,
              feature_cols=["feature"],
              label_cols=["label"],
              validation_data=df,
              validation_steps=1,
          )
  
          print("start saving")
          trainer.save(os.path.join(temp_dir, "cifar10.h5"))
  
          res = trainer.evaluate(
              df,
              batch_size=4,
              num_steps=25,
              feature_cols=["feature"],
              label_cols=["label"],
          )
          print("validation result: ", res)
  
          before_res = trainer.predict(
              df, feature_cols=["feature"]
          ).collect()
          expect_res = np.concatenate(
              [part["prediction"] for part in before_res]
          )
  
          trainer.load(os.path.join(temp_dir, "cifar10.h5"))
  
          # continous predicting
          after_res = trainer.predict(
              df, feature_cols=["feature"]
          ).collect()
          pred_res = np.concatenate(
              [part["prediction"] for part in after_res]
          )
  
          assert np.array_equal(expect_res, pred_res)
  
          # continous training
          res = trainer.fit(
              df,
              epochs=5,
              batch_size=4,
              steps_per_epoch=25,
              feature_cols=["feature"],
              label_cols=["label"],
              validation_data=df,
              validation_steps=1,
          )
      finally:
          shutil.rmtree(temp_dir)
  
imports: import math
  import os
  import shutil
  import tempfile
  import pytest
  from unittest import TestCase
  import tensorflow
  import numpy
  from bigdl.orca.data.pandas import read_csv
  from bigdl.orca.data import SparkXShards, XShards
  from bigdl.orca.data.tf.data import Dataset
  from bigdl.orca.learn.tf2 import Estimator
  from bigdl.orca.ray import OrcaRayContext
  from bigdl.orca import OrcaContext
label_desc: Use image node_id 17 for calling the TestTF2EstimatorRayBackend obj's underlying member method code with example usage: obj.test_save_load_model_h5() without return types