code: def setUp(
      self,
      ndims: Sequence[Tuple[int, int]] = (2, 4),
      lower_quantile_max: float = 0.9,  # if these get too far into the tail, naive
      upper_quantile_min: float = 0.1,  # MC methods will not produce any samples.
      num_log_probs: int = 4,
      seed: int = 1,
  ) -> None:
      super().setUp()
      self.seed_generator = count(seed)
      self.num_log_probs = num_log_probs
  
      tkwargs = {"dtype": torch.float64}
      self.distributions = []
      self.sqrt_covariances = []
      with torch.random.fork_rng():
          torch.random.manual_seed(next(self.seed_generator))
          for ndim in ndims:
              loc = torch.randn(ndim, **tkwargs)
              sqrt_covariance = self.gen_covariances(
                  ndim, as_sqrt=True
              ).to(**tkwargs)
              covariance_matrix = (
                  sqrt_covariance @ sqrt_covariance.transpose(-1, -2)
              )
              std = covariance_matrix.diag().sqrt()
  
              lb = lower_quantile_max * torch.rand(ndim, **tkwargs)
              ub = lb.clip(min=upper_quantile_min)  # scratch variable
              ub = ub + (1 - ub) * torch.rand(ndim, **tkwargs)
              bounds = loc.unsqueeze(-1) + std.unsqueeze(-1) * ndtri(
                  torch.stack([lb, ub], dim=-1)
              )
  
              self.distributions.append(
                  TruncatedMultivariateNormal(
                      loc=loc,
                      covariance_matrix=covariance_matrix,
                      bounds=bounds,
                      validate_args=True,
                  )
              )
              self.sqrt_covariances.append(sqrt_covariance)
  
file_path: botorch/test/utils/probability/test_truncated_multivariate_normal.py
imports: from __future__ import annotations
  from itertools import count
  from typing import Sequence, Tuple
  import torch
  from botorch.utils.probability.mvnxpb import MVNXPB
  from botorch.utils.probability.truncated_multivariate_normal import TruncatedMultivariateNormal
  from botorch.utils.testing import BotorchTestCase
  from torch import Tensor
  from torch.distributions import MultivariateNormal
  from torch.special import ndtri
label_desc: Use image node_id 1 for calling the TestTruncatedMultivariateNormal obj's underlying member method code with example usage: obj.setUp(ndims, lower_quantile_max, upper_quantile_min, num_log_probs, seed) without return types