class_docstr: A recipe involves both grid search and random search, only for Seq2SeqPytorch.
  Note: This recipe is specifically designed for third-party model searching, rather
  than TimeSequencePredictor.
code: def _gen_sample_func(self, ranges, param_name):
      from bigdl.nano.utils.common import invalidInputError
  
      if isinstance(ranges, tuple):
          invalidInputError(
              len(ranges) == 2,
              f"length of tuple {param_name} should be"
              f" 2 while get {len(ranges)} instead.",
          )
          invalidInputError(
              param_name != "teacher_forcing",
              f"type of {param_name} can only be a list while get a tuple",
          )
          if param_name in ["lr"]:
              return hp.loguniform(lower=ranges[0], upper=ranges[1])
          if param_name in [
              "lstm_hidden_dim",
              "lstm_layer_num",
              "batch_size",
          ]:
              return hp.randint(lower=ranges[0], upper=ranges[1])
          if param_name in ["dropout"]:
              return hp.uniform(lower=ranges[0], upper=ranges[1])
      if isinstance(ranges, list):
          return hp.grid_search(ranges)
          invalidInputError(
              False, f"{param_name} should be either a list or a tuple."
          )
  
imports: from bigdl.chronos.autots.deprecated.config.base import Recipe
  from bigdl.orca.automl import hp
  from bigdl.chronos.utils import deprecated
label_desc: Use image node_id 2 for calling the LSTMSeq2SeqRandomRecipe obj's underlying member method code with example usage: obj._gen_sample_func(ranges, param_name) and returns: hp, hp, hp, hp