class_docstr: A Wrapper to shield user from Optuna specific configurations and API      Later may support other HPO search engines.
class_docstr_tok: ["A","Wrapper","to","shield","user","from","Optuna","specific","configurations","and","API","Later","may","support","other","HPO","search","engines","."]
code: def _sample_space(trial, hp_name, hp_obj):
      hp_type = str(type(hp_obj)).lower()  # type of hyperparam
      if (
          "integer" in hp_type
          or "float" in hp_type
          or "categorical" in hp_type
          or "ordinal" in hp_type
      ):
          try:
              if "integer" in hp_type:
                  hp_dimension = trial.suggest_int(
                      name=hp_name,
                      low=int(hp_obj.lower),
                      high=int(hp_obj.upper),
                  )
              elif "float" in hp_type:
                  if hp_obj.log:  # log10-scale hyperparmeter
                      hp_dimension = trial.suggest_loguniform(
                          name=hp_name,
                          low=float(hp_obj.lower),
                          high=float(hp_obj.upper),
                      )
                  else:
                      hp_dimension = trial.suggest_float(
                          name=hp_name,
                          low=float(hp_obj.lower),
                          high=float(hp_obj.upper),
                      )
              elif "categorical" in hp_type:
                  hp_dimension = trial.suggest_categorical(
                      name=hp_name, choices=hp_obj.choices
                  )
              elif "ordinal" in hp_type:
                  hp_dimension = trial.suggest_categorical(
                      name=hp_name, choices=hp_obj.sequence
                  )
          except RuntimeError:
              # TODO ValueErrors might be throw due to other reasons.
              invalidInputError(
                  False,
                  "If you set search space in model, "
                  "you must call model.search before model.fit.",
              )
      else:
          invalidInputError(
              False,
              "unknown hyperparameter type %s for param %s"
              % (hp_type, hp_name),
          )
      return hp_dimension
  
file_path: BigDL/python/nano/src/bigdl/nano/deps/automl/optuna_backend.py
imports: from bigdl.nano.automl.hpo.backend import PrunerType, SamplerType
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.automl.hpo.space import SimpleSpace, NestedSpace, AutoObject
  from bigdl.nano.automl.hpo.space import AutoObject, Space, SingleParam, _get_hp_prefix
  import optuna
label_desc: Use image node_id 2 for calling the OptunaBackend obj's underlying member method code with example usage: obj._sample_space(trial, hp_name, hp_obj) and returns: hp_dimension