code: def get_d_moments(model,x):
      '''
      Gradients with respect to x of the moments (mean and sdev.) of the GP
      :param model: GPy model.
      :param x: location where the gradients are evaluated.
      '''
      input_dim = model.input_dim
      x = reshape(x,input_dim)
      _, v = model.predict(x)
      dmdx, dvdx = model.predictive_gradients(x)
      dmdx = dmdx[:,:,0]
      dsdx = dvdx / (2*np.sqrt(v))
      return (dmdx, dsdxf get_d_moments(model,x):
      '''
      Gradients with respect to x of the moments (mean and sdev.) of the GP
      :param model: GPy model.
      :param x: location where the gradients are evaluated.
      '''
      input_dim = model.input_dim
      x = reshape(x,input_dim)
      _, v = model.predict(x)
      dmdx, dvdx = model.predictive_gradients(x)
      dmdx = dmdx[:,:,0]
      dsdx = dvdx / (2*np.sqrt(v))
      return (dmdx, dsdx)
docs: Gradients with respect to x of the moments (mean and sdev.) of the GP
      :param model: GPy model.
      :param x: location where the gradients are evaluated.