code: def grad_optimize_ei_over_hypers(
      self, cand, comp, vals, durs, compute_grad=True
  ):
      summed_ei = 0
      summed_grad_ei = np.zeros(cand.shape).flatten()
  
      for mcmc_iter in range(self.mcmc_iters):
          hyper = self.hyper_samples[mcmc_iter]
          time_hyper = self.time_hyper_samples[mcmc_iter]
          self.mean = hyper[0]
          self.noise = hyper[1]
          self.amp2 = hyper[2]
          self.ls = hyper[3]
  
          self.time_mean = time_hyper[0]
          self.time_noise = time_hyper[1]
          self.time_amp2 = time_hyper[2]
          self.time_ls = time_hyper[3]
  
          if compute_grad:
              (ei, g_ei) = self.grad_optimize_ei(
                  cand, comp, vals, durs, compute_grad
              )
              summed_grad_ei = summed_grad_ei + g_ei
          else:
              ei = self.grad_optimize_ei(
                  cand, comp, vals, durs, compute_grad
              )
  
          summed_ei += ei
  
      if compute_grad:
          return (summed_ei, summed_grad_ei)
      else:
          return summed_ei
  
imports: import os
  from ..None import gp
  import sys
  from ..None import util
  import tempfile
  import numpy
  import numpy.random
  import scipy.linalg
  import scipy.stats
  import scipy.optimize
  import pickle
  from ..helpers import *
  from ..Locker import *
  import logging
label_desc: Use image node_id 8 for calling the GPEIperSecChooser obj's underlying member method code with example usage: obj.grad_optimize_ei_over_hypers(cand, comp, vals, durs, compute_grad) and returns: summed_ei,  summed_grad_ei, summed_ei