code: def test_train(self):
      estimator = Estimator.from_keras(
          model_creator=model_creator,
          verbose=True,
          config=None,
          backend="ray",
          workers_per_node=2,
      )
  
      start_stats = estimator.evaluate(
          create_test_dataset, batch_size=32, num_steps=2
      )
      print(start_stats)
  
      train_stats = estimator.fit(
          create_train_datasets, epochs=1, batch_size=32
      )
      print("This is Train Results:", train_stats)
  
      end_stats = estimator.evaluate(
          create_test_dataset, batch_size=32, num_steps=2
      )
      print("This is Val Results:", end_stats)
  
      assert isinstance(train_stats, dict), "fit should return a dict"
      assert isinstance(
          end_stats, dict
      ), "evaluate should return a dict"
      assert estimator.get_model()
  
      dloss = (
          end_stats["validation_loss"] - start_stats["validation_loss"]
      )
      dmse = (
          end_stats["validation_mean_squared_error"]
          - start_stats["validation_mean_squared_error"]
      )
      print(f"dLoss: {dloss}, dMSE: {dmse}")
  
      assert (
          dloss < 0 and dmse < 0
      ), "training sanity check failed. loss increased!"
  
file_path: BigDL/python/orca/test/bigdl/orca/learn/ray/ctx/test_tf2_ray_runtime.py
imports: import pytest
  from unittest import TestCase
  import numpy
  import tensorflow
  from bigdl.orca import init_orca_context, stop_orca_context
  from bigdl.orca.learn.tf2 import Estimator
label_desc: Use image node_id 3 for calling the TestTF2Estimator obj's underlying member method code with example usage: obj.test_train() without return types