class_docstr: A Minin object to add hpo related methods to models.
  
  It is used to add hpo related search methods onto
  tf.keras.Sequential, tf.keras.Model, as well as custom
      model subclassing from tf.keras.Model.
class_docstr_tok: ["A","Minin","object","to","add","hpo","related","methods","to","models",".","It","is","used","to","add","hpo","related","search","methods","onto","tf.keras.Sequential",",","tf.keras.Model",",","as","well","as","custom","model","subclassing","from","tf.keras.Model","."]
code: def _model_compile(self, model, trial):
      # for lazy model compile
      # objects like Optimizers has internal states so
      # each trial needs to have a copy of its own.
      # TODO may allow users to pass a creator function
      # to avoid deep copy of objects
      compile_args = copy.deepcopy(self.compile_args)
      compile_kwargs = copy.deepcopy(self.compile_kwargs)
  
      # instantiate optimizers if it is autoobj
      optimizer = compile_kwargs.get("optimizer", None)
      if optimizer and isinstance(optimizer, AutoObject):
          optimizer = self.backend.instantiate(trial, optimizer)
          compile_kwargs["optimizer"] = optimizer
      model.compile(*compile_args, **compile_kwargs)
  
imports: import copy
  import warnings
  from .objective import Objective
  from bigdl.nano.automl.hpo.backend import create_hpo_backend
  from bigdl.nano.automl.hpo.search import _search_summary, _end_search, _create_study, _validate_args, _strip_val_prefix, _prepare_args
  from bigdl.nano.automl.hpo.space import AutoObject
  from bigdl.nano.utils.common import invalidInputError
  from bigdl.nano.automl.utils.parallel import run_parallel
  import math
label_desc: Use image node_id 16 for calling the HPOMixin obj's underlying member method code with example usage: obj._model_compile(model, trial) without return types