docstr: Computes the first order Sobol indices:
  
  Returns:
      if num_bootstrap_samples>1
          Tensor: (values,var_mc,stderr_mc)x dim
      else
          Tensor: (values)x dim
docstr_tok: ["Computes","the","first","order","Sobol","indices",":","Returns",":","if","num_bootstrap_samples",">","1","Tensor",":","(","values",",","var_mc",",","stderr_mc",")","x","dim","else","Tensor",":","(","values",")","x","dim"]
code: def first_order_indices(self) -> Tensor:
      r"""Computes the first order Sobol indices:
  
      Returns:
          if num_bootstrap_samples>1
              Tensor: (values,var_mc,stderr_mc)x dim
          else
              Tensor: (values)x dim
      """
      first_order_idxs = []
      for i in range(self.dim):
          vi = (
              torch.mean(
                  self.f_B * (self.f_ABis[i] - self.f_A)
              )  # pyre-ignore
              / self.f_total_var
          )
          first_order_idxs.append(vi.unsqueeze(0))
      self.first_order_idxs = torch.cat(
          first_order_idxs, dim=0
      ).detach()
      if not (self.bootstrap):
          return self.first_order_idxs
      else:
          first_order_idxs_btsp = [
              torch.cat(first_order_idxs, dim=0).unsqueeze(0)
          ]
          for b in range(self.num_bootstrap_samples):
              first_order_idxs = []
              for i in range(self.dim):
                  vi = (
                      torch.mean(
                          self.f_B_btsp[b]
                          * (self.f_ABis_btsp[b][i] - self.f_A_btsp[b])
                      )
                      / self.f_total_var_btsp[b]
                  )
                  first_order_idxs.append(vi.unsqueeze(0))
              first_order_idxs_btsp.append(
                  torch.cat(first_order_idxs, dim=0).unsqueeze(0)
              )
          self.first_order_idxs_btsp = torch.cat(
              first_order_idxs_btsp, dim=0
          )
          if self.bootstrap_array:
              return self.first_order_idxs_btsp.detach()
          else:
              return (
                  torch.cat(
                      [
                          self.first_order_idxs_btsp.mean(
                              dim=0
                          ).unsqueeze(0),
                          self.first_order_idxs_btsp.var(  # pyre-ignore
                              dim=0
                          ).unsqueeze(0),
                          torch.sqrt(
                              self.first_order_idxs_btsp.var(dim=0)
                              / (self.num_bootstrap_samples + 1)
                          ).unsqueeze(0),
                      ],
                      dim=0,
                  )
                  .t()
                  .detach()
              )
  
imports: from copy import deepcopy
  from typing import Any, Callable, Dict, List, Optional, Union
  import numpy
  import torch
  from ax.modelbridge.torch import TorchModelBridge
  from ax.models.torch.botorch import BotorchModel
  from ax.models.torch.botorch_modular.model import BoTorchModel
  from ax.utils.common.typeutils import checked_cast
  from botorch.models.model import Model, ModelList
  from botorch.posteriors.gpytorch import GPyTorchPosterior
  from botorch.sampling.normal import SobolQMCNormalSampler
  from botorch.utils.sampling import draw_sobol_samples
  from botorch.utils.transforms import unnormalize
  from torch import Tensor
label_desc: Use image node_id 4 for calling the SobolSensitivity obj's underlying member method code with example usage: obj.first_order_indices() and returns: self, self, torch