code: def test_train_and_evaluate(self):
      orca_estimator = get_estimator(workers_per_node=2)
      train_dataset = train_data_creator()
      validation_dataset = val_data_creator()
  
      data_config_args = {
          "output_signature": (
              tf.TensorSpec(shape=(None, 1), dtype=tf.float32),
              tf.TensorSpec(shape=(None), dtype=tf.float32),
          )
      }
  
      start_eval_stats = orca_estimator.evaluate(
          data=validation_dataset,
          num_steps=2,
          batch_size=32,
          label_cols="x",
          feature_cols=["y"],
          data_config=data_config_args,
      )
  
      train_stats = orca_estimator.fit(
          data=train_dataset,
          epochs=2,
          batch_size=32,
          label_cols="x",
          feature_cols=["y"],
          data_config=data_config_args,
      )
      print(train_stats)
  
      end_eval_stats = orca_estimator.evaluate(
          data=validation_dataset,
          num_steps=2,
          batch_size=32,
          label_cols="x",
          feature_cols=["y"],
          data_config=data_config_args,
      )
  
      assert isinstance(train_stats, dict), "fit should return a dict"
      assert isinstance(
          end_eval_stats, dict
      ), "evaluate should return a dict"
      assert orca_estimator.get_model()
  
      dloss = (
          end_eval_stats["validation_loss"]
          - start_eval_stats["validation_loss"]
      )
      dmse = (
          end_eval_stats["validation_mean_squared_error"]
          - start_eval_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_dataset.py
imports: import pytest
  from unittest import TestCase
  import ray
  from ray.data import Dataset
  import tensorflow
  from bigdl.orca.learn.tf2 import Estimator
  from bigdl.orca import init_orca_context, stop_orca_context
label_desc: Use image node_id 3 for calling the TestTF2Estimator obj's underlying member method code with example usage: obj.test_train_and_evaluate() without return types