code: def test_lstm_customized_loss_metric(self):
      train_data, _, test_data = create_data(tf_data=True)
      loss = tf.keras.losses.MeanSquaredError()
  
      def customized_metric(y_true, y_pred):
          return tf.keras.losses.MeanSquaredError(
              tf.convert_to_tensor(y_pred), tf.convert_to_tensor(y_true)
          ).numpy()
  
      from bigdl.chronos.forecaster.tf.lstm_forecaster import (
          LSTMForecaster,
      )
  
      self.forecaster = LSTMForecaster(
          past_seq_len=10,
          input_feature_num=10,
          output_feature_num=2,
          loss=loss,
          metrics=[customized_metric],
          lr=0.01,
      )
      self.forecaster.fit(train_data, epochs=2, batch_size=32)
      yhat = self.forecaster.predict(test_data)
      with tempfile.TemporaryDirectory() as tmp_dir_file:
          tmp_dir_file = os.path.join(tmp_dir_file, "lstm.ckpt")
          self.forecaster.save(tmp_dir_file)
          self.forecaster.load(tmp_dir_file)
          from bigdl.chronos.model.tf2.VanillaLSTM_keras import (
              LSTMModel,
          )
  
          assert isinstance(self.forecaster.internal, LSTMModel)
      load_model_yhat = self.forecaster.predict(test_data)
      assert yhat.shape == (400, 1, 2)
      np.testing.assert_almost_equal(yhat, load_model_yhat, decimal=5)
  
imports: import pytest
  import tempfile
  import os
  from unittest import TestCase
  import numpy
  from bigdl.chronos.utils import LazyImport
  from test.bigdl.chronos import op_tf2, op_distributed
label_desc: Use image node_id 6 for calling the TestLSTMForecaster obj's underlying member method code with example usage: obj.test_lstm_customized_loss_metric() and returns: tf