code: def test_lstm_forecaster_quantization(self):
      train_data, val_data, test_data = create_data()
      forecaster = LSTMForecaster(
          past_seq_len=24,
          input_feature_num=2,
          output_feature_num=2,
          loss="mae",
          lr=0.01,
      )
      forecaster.fit(train_data, epochs=2)
      # no tunning quantization
      forecaster.quantize(train_data)
      pred_q = forecaster.predict(
          test_data[0], quantize=True, acceleration=False
      )
      eval_q = forecaster.evaluate(
          test_data, quantize=True, acceleration=False
      )
      # reset model
      forecaster.internal.train()
      forecaster.internal.eval()
      # quantization with tunning
      forecaster.quantize(
          train_data,
          val_data=val_data,
          metric="mse",
          relative_drop=0.99,
          max_trials=3,
      )
      pred_q = forecaster.predict(
          test_data[0], quantize=True, acceleration=False
      )
      eval_q = forecaster.evaluate(
          test_data, quantize=True, acceleration=False
      )
      with tempfile.TemporaryDirectory() as tmp_dir_name:
          ckpt_name = os.path.join(tmp_dir_name, "ckpt")
          ckpt_name_q = os.path.join(tmp_dir_name, "ckpt.q")
          test_pred_save = forecaster.predict(
              test_data[0], acceleration=False
          )
          test_pred_save_q = forecaster.predict(
              test_data[0], quantize=True, acceleration=False
          )
          forecaster.save(ckpt_name, ckpt_name_q)
          forecaster.load(ckpt_name, ckpt_name_q)
          test_pred_load = forecaster.predict(
              test_data[0], acceleration=False
          )
          test_pred_load_q = forecaster.predict(
              test_data[0], quantize=True, acceleration=False
          )
      np.testing.assert_almost_equal(test_pred_save, test_pred_load)
      np.testing.assert_almost_equal(test_pred_save_q, test_pred_load_q)
  
imports: import numpy
  import tempfile
  import os
  from bigdl.chronos.utils import LazyImport
  from unittest import TestCase
  import pytest
  from ..None import op_torch, op_distributed, op_inference, op_automl
label_desc: Use image node_id 10 for calling the TestChronosModelLSTMForecaster obj's underlying member method code with example usage: obj.test_lstm_forecaster_quantization() without return types