code: def _match_val_type(vals, bounds):
      """
      Update values in the array, to match their corresponding type, make sure the value is legal.
  
      Parameters
      ----------
      vals : numpy array
          values of parameters
      bounds : numpy array
          list of dictionary which stores parameters names and legal values.
  
      Returns
      -------
      vals_new : list
          The closest legal value to the original value
      """
      vals_new = []
  
      for i, bound in enumerate(bounds):
          _type = bound["_type"]
          if _type == "choice":
              # Find the closest integer in the array, vals_bounds
              # pylint: disable=cell-var-from-loop
              vals_new.append(
                  min(bound["_value"], key=lambda x: abs(x - vals[i]))
              )
          elif _type in ["quniform", "randint"]:
              vals_new.append(np.around(vals[i]))
          else:
              vals_new.append(vals[i])
  
      return vals_new
  
file_path: nni/nni/algorithms/hpo/gp_tuner/util.py
imports: import warnings
  import numpy
  from scipy.stats import norm
  from scipy.optimize import minimize
label_desc: Use image node_id 1 for calling a global function with example usage: _match_val_type(vals, bounds) and returns: vals_new