code: def model_creator(config):
      hidden_dim = config.get("hidden_dim", 32)
      dropout = config.get("dropout", 0.2)
      layer_num = config.get("layer_num", 2)
      from bigdl.nano.utils.common import invalidInputError
  
      if isinstance(hidden_dim, list):
          invalidInputError(
              len(hidden_dim) == layer_num,
              "length of hidden_dim should be equal to layer_num",
          )
      if isinstance(dropout, list):
          invalidInputError(
              len(dropout) == layer_num,
              "length of dropout should be equal to layer_num",
          )
      if isinstance(hidden_dim, int):
          hidden_dim = [hidden_dim] * layer_num
      if isinstance(dropout, (float, int)):
          dropout = [dropout] * layer_num
      model = LSTMModel(
          input_dim=config["input_feature_num"],
          hidden_dim=hidden_dim,
          layer_num=layer_num,
          dropout=dropout,
          output_dim=config["output_feature_num"],
      )
  
      learning_rate = config.get("lr", 1e-3)
      optimizer = getattr(
          tf.keras.optimizers, config.get("optim", "Adam")
      )(learning_rate)
      model.compile(
          loss=config.get("loss", "mse"),
          optimizer=optimizer,
          metrics=[config.get("metric", "mse")],
      )
      return model
  
file_path: BigDL/python/chronos/src/bigdl/chronos/model/tf2/VanillaLSTM_keras.py
imports: import tensorflow
  from bigdl.nano.tf.keras import Sequential, Model
  from tensorflow.keras.layers import LSTM, Reshape, Dense, Input
label_desc: Use image node_id 1 for calling a global function with example usage: model_creator(config) and returns: model