class_docstr: Class for parsing hyperparameters
class_docstr_tok: ["Class","for","parsing","hyperparameters"]
code: def convert_to_tuples(self, hyperparameters):
      if self.runner_args.optimizer == "grid":
          all_hyperparam_values = []
          for h in hyperparameters:
              assert h.values is not None
              hyperparam_values = [
                  (h.name, value) for value in h.values
              ]
              all_hyperparam_values.append(hyperparam_values)
  
          hyperparam_tuples = []
          for item in itertools.product(*all_hyperparam_values):
              hyperparam_tuple = {}
              for name, param in item:
                  hyperparam_tuple[name] = param
              hyperparam_tuples.append(hyperparam_tuple)
      else:
          hyperparam_tuples = []
          for hyperparam_list in hyperparameters:
              hyperparam_dict = {}
              for h in hyperparam_list:
                  hyperparam_dict[h.name] = h.values
              hyperparam_tuples.append(hyperparam_dict)
  
      # print hyperparam_tuples
      return hyperparam_tuples
  
file_path: studio/studio/hyperparameter.py
imports: import itertools
  import math
  import numpy
label_desc: Use image node_id 2 for calling the HyperparameterParser obj's underlying member method code with example usage: obj.convert_to_tuples(hyperparameters) and returns: hyperparam_tuples