code: def gen_covariances(
      self,
      ndim: int,
      batch_shape: Sequence[int] = (),
      as_sqrt: bool = False,
  ) -> Tensor:
      shape = tuple(batch_shape) + (ndim, ndim)
      eigvals = -torch.rand(shape[:-1]).log()  # exponential rvs
      orthmat = torch.linalg.svd(torch.randn(shape)).U
      sqrt_covar = orthmat * torch.sqrt(eigvals).unsqueeze(-2)
      return (
          sqrt_covar
          if as_sqrt
          else sqrt_covar @ sqrt_covar.transpose(-2, -1)
      )
  
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 2 for calling the TestTruncatedMultivariateNormal obj's underlying member method code with example usage: obj.gen_covariances(ndim, batch_shape, as_sqrt) and returns: unknown