class_docstr: The Tuning objective for HPO.
docstr: Execute Training and return target metric in each trial.
  
  :param: trial: a trial object which provides the hyperparameter combinition.
  :return: the target metric value.
docstr_tok: ["Execute","Training","and","return","target","metric","in","each","trial",".",":","param",":","trial",":","a","trial","object","which","provides","the","hyperparameter","combinition",".",":","return",":","the","target","metric","value","."]
code: def __call__(self, trial):
      """
      Execute Training and return target metric in each trial.
  
      :param: trial: a trial object which provides the hyperparameter combinition.
      :return: the target metric value.
      """
      if _is_creator(self.model):
          model = self.model(trial)
      else:
          # copy model so that the original model is not changed
          # Need tests to check this path
          model = copy.deepcopy(self.model)
  
      self._pre_train(model, trial)
      self.searcher._run(model)
      if self.mo_hpo:
          scores = []
          for metric in self.target_metric:
              if metric == self.metric:
                  if self.mode == "last":
                      score = self.searcher.trainer.callback_metrics[
                          self.target_metric
                      ].item()
                  elif self.mode == "best":
                      score = self.searcher.trainer.callback_metrics[
                          "_best_score"
                      ].item()
              else:
                  score = self.searcher.trainer.callback_metrics[
                      metric
                  ].item()
              scores.append(score)
      else:
          if self.mode == "last":
              scores = self.searcher.trainer.callback_metrics[
                  self.target_metric
              ].item()
          elif self.mode == "best":
              scores = self.searcher.trainer.callback_metrics[
                  "_best_score"
              ].item()
  
      if self.acceleration:
          scores, optimization = self._auto_acceleration(model, scores)
          # via user_attr returns the choosed optimization corresponding
          # to the minimum latency
          trial.set_user_attr("optimization", optimization)
      self._post_train(model)
      return scores
  
imports: from collections import namedtuple
  from typing import Optional, Union
  import pytorch_lightning
  from pytorch_lightning.utilities.types import EVAL_DATALOADERS, TRAIN_DATALOADERS
  from pytorch_lightning.utilities import rank_zero_deprecation
  from pytorch_lightning.core.datamodule import LightningDataModule
  from bigdl.nano.pytorch import InferenceOptimizer
  from bigdl.nano.automl.hpo.backend import create_pl_pruning_callback
  from bigdl.nano.utils.common import invalidInputError
  from ._helper import LatencyCallback, _remove_metric_prefix, BestMetricCallback
  import inspect
  import copy
label_desc: Use image node_id 7 for calling the Objective obj's underlying member method code with example usage: obj.__call__(trial) and returns: scores