code: def _compute_gradient_quantities(
      self,
      posterior: Union[GPyTorchPosterior, MultivariateNormal],
      Y_scale: float,
  ) -> None:
      if self.derivative_gp:
          self.mean_gradients = (
              checked_cast(torch.Tensor, posterior.mean) * Y_scale
          )
      else:
          predictive_mean = posterior.mean
          torch.sum(predictive_mean).backward()
          self.mean_gradients = (
              checked_cast(torch.Tensor, self.input_mc_samples.grad)
              * Y_scale
          )
      if self.bootstrap:
          subset_size = 2
          self.bootstrap_indices = torch.randint(
              0,
              self.num_mc_samples,
              (self.num_bootstrap_samples, subset_size),
          )
          self.mean_gradients_btsp = [
              torch.index_select(
                  checked_cast(torch.Tensor, self.mean_gradients),
                  0,
                  indices,
              )
              for indices in self.bootstrap_indices
          ]
  
imports: from copy import deepcopy
  from typing import Callable, List, Optional, Union
  import torch
  from ax.utils.common.typeutils import checked_cast, not_none
  from ax.utils.sensitivity.derivative_gp import posterior_derivative
  from botorch.models.model import Model
  from botorch.posteriors.gpytorch import GPyTorchPosterior
  from botorch.posteriors.posterior import Posterior
  from botorch.sampling.normal import SobolQMCNormalSampler
  from botorch.utils.sampling import draw_sobol_samples
  from botorch.utils.transforms import unnormalize
  from gpytorch.distributions import MultivariateNormal
label_desc: Use image node_id 2 for calling the GpDGSMGpMean obj's underlying member method code with example usage: obj._compute_gradient_quantities(posterior, Y_scale) without return types