docstr: Computes the Second order Sobol indices:
  
  Returns:
      if num_bootstrap_samples>1
          Tensor: (values, var_gp, stderr_gp, var_mc, stderr_mc) x dim(dim-1) / 2
      else
          Tensor: (values, var, stderr) x dim(dim-1) / 2
docstr_tok: ["Computes","the","Second","order","Sobol","indices",":","Returns",":","if","num_bootstrap_samples",">","1","Tensor",":","(","values",",","var_gp",",","stderr_gp",",","var_mc",",","stderr_mc",")","x","dim","(","dim-1",")","\/","2","else","Tensor",":","(","values",",","var",",","stderr",")","x","dim","(","dim-1",")","\/","2"]
code: def second_order_indices(self) -> Tensor:
      r"""Computes the Second order Sobol indices:
  
      Returns:
          if num_bootstrap_samples>1
              Tensor: (values, var_gp, stderr_gp, var_mc, stderr_mc) x dim(dim-1) / 2
          else
              Tensor: (values, var, stderr) x dim(dim-1) / 2
      """
      if not (self.bootstrap):
          second_order_idxs_list = []
          for j in range(self.num_gp_samples):
              self.sensitivity.evalute_function(self.samples[j])
              second_order_idxs = self.sensitivity.second_order_indices(
                  # pyre-fixme[16]: `SobolSensitivityGPSampling` has no attribute
                  #  `first_order_idxs_list`.
                  self.first_order_idxs_list[j]
              )
              second_order_idxs_list.append(
                  second_order_idxs.unsqueeze(0)
              )
          second_order_idxs_list = torch.cat(
              second_order_idxs_list, dim=0
          )
          second_order_idxs_mean_var = []
          for i in range(len(second_order_idxs)):
              second_order_idxs_mean_var.append(
                  torch.tensor(
                      [
                          torch.mean(second_order_idxs_list[:, i]),
                          torch.var(second_order_idxs_list[:, i]),
                          torch.sqrt(
                              torch.var(second_order_idxs_list[:, i])
                              / self.num_gp_samples
                          ),
                      ]
                  ).unsqueeze(0)
              )
          second_order_idxs_mean_var = torch.cat(
              second_order_idxs_mean_var, dim=0
          )
          return second_order_idxs_mean_var
      else:
          second_order_idxs_list = []
          for j in range(self.num_gp_samples):
              self.sensitivity.evalute_function(self.samples[j])
              second_order_idxs = self.sensitivity.second_order_indices(
                  self.first_order_idxs_list[j][0],
                  self.first_order_idxs_list[j][1:],
              )
              second_order_idxs_list.append(
                  second_order_idxs.unsqueeze(0)
              )
          second_order_idxs_list = torch.cat(
              second_order_idxs_list, dim=0
          )
          var_per_bootstrap = torch.var(second_order_idxs_list, dim=0)
          gp_var = torch.mean(var_per_bootstrap, dim=0)
          gp_se = torch.sqrt(gp_var / self.num_gp_samples)
          var_per_gp_sample = torch.var(second_order_idxs_list, dim=1)
          mc_var = torch.mean(var_per_gp_sample, dim=0)
          mc_se = torch.sqrt(mc_var / (self.num_bootstrap_samples + 1))
          num_second_order = second_order_idxs_list.shape[-1]
          total_mean = second_order_idxs_list.reshape(
              -1, num_second_order
          ).mean(dim=0)
          second_order_idxs_mean_vargp_segp_varmc_segp = torch.cat(
              [
                  torch.tensor(
                      [
                          total_mean[i],
                          gp_var[i],
                          gp_se[i],
                          mc_var[i],
                          mc_se[i],
                      ]
                  ).unsqueeze(0)
                  for i in range(num_second_order)
              ],
              dim=0,
          )
          return second_order_idxs_mean_vargp_segp_varmc_segp
  
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 5 for calling the SobolSensitivityGPSampling obj's underlying member method code with example usage: obj.second_order_indices() and returns: second_order_idxs_mean_var, second_order_idxs_mean_vargp_segp_varmc_segp