code: def to_bigdl_criterion(criterion):
      criterion = criterion.lower()
      if criterion == "categorical_crossentropy":
          return CategoricalCrossEntropy()
      elif criterion == "mse" or criterion == "mean_squared_error":
          return MeanSquaredError()
      elif criterion == "binary_crossentropy":
          return BinaryCrossEntropy()
      elif criterion == "mae" or criterion == "mean_absolute_error":
          return mae()
      elif criterion == "hinge":
          return Hinge()
      elif (
          criterion == "mean_absolute_percentage_error"
          or criterion == "mape"
      ):
          return MeanAbsolutePercentageError()
      elif (
          criterion == "mean_squared_logarithmic_error"
          or criterion == "msle"
      ):
          return MeanSquaredLogarithmicError()
      elif criterion == "squared_hinge":
          return SquaredHinge()
      elif criterion == "sparse_categorical_crossentropy":
          return SparseCategoricalCrossEntropy()
      elif (
          criterion == "kullback_leibler_divergence"
          or criterion == "kld"
      ):
          return KullbackLeiblerDivergence()
      elif criterion == "poisson":
          return Poisson()
      elif criterion == "cosine_proximity" or criterion == "cosine":
          return CosineProximity()
      elif criterion == "rank_hinge":
          return RankHinge()
      else:
          invalidInputError(False, "Unsupported loss: %s" % criterion)
  
imports: from bigdl.dllib.optim.optimizer import *
  from bigdl.dllib.keras.objectives import *
  from bigdl.dllib.keras import metrics
  from bigdl.dllib.utils.log4Error import *
label_desc: Use image node_id 2 for calling a global function with example usage: to_bigdl_criterion(criterion) and returns: CategoricalCrossEntropy, MeanSquaredError, BinaryCrossEntropy, mae, Hinge, MeanAbsolutePercentageError, MeanSquaredLogarithmicError, SquaredHinge, SparseCategoricalCrossEntropy, KullbackLeiblerDivergence, Poisson, CosineProximity, RankHinge