code: def test_bivariate(self):
      for dtype in (torch.float, torch.double):
          tkwargs = {"device": self.device, "dtype": dtype}
          # special case: N(0, I) truncated to positive numbers
          A = -torch.eye(2, **tkwargs)
          b = torch.zeros(2, 1, **tkwargs)
          sampler = LinearEllipticalSliceSampler(
              inequality_constraints=(A, b)
          )
          self.assertIsNone(sampler._mean)
          self.assertIsNone(sampler._covariance_root)
          self.assertTrue(torch.all(sampler._is_feasible(sampler.x0)))
          samples = sampler.draw(n=3)
          self.assertEqual(samples.shape, torch.Size([3, 2]))
          self.assertGreaterEqual(samples.min().item(), 0.0)
          self.assertFalse(torch.equal(sampler._x, sampler.x0))
          # same case as above, but instantiated with bounds
          sampler = LinearEllipticalSliceSampler(
              bounds=torch.tensor(
                  [[0.0, 0.0], [float("inf"), float("inf")]], **tkwargs
              ),
          )
          self.assertIsNone(sampler._mean)
          self.assertIsNone(sampler._covariance_root)
          self.assertTrue(torch.all(sampler._is_feasible(sampler.x0)))
          samples = sampler.draw(n=3)
          self.assertEqual(samples.shape, torch.Size([3, 2]))
          self.assertGreaterEqual(samples.min().item(), 0.0)
          self.assertFalse(torch.equal(sampler._x, sampler.x0))
          # A case with bounded domain and non-standard mean and covariance
          mean = -3.0 * torch.ones(2, 1, **tkwargs)
          covariance_matrix = torch.tensor(
              [[4.0, 2.0], [2.0, 2.0]], **tkwargs
          )
          bounds = torch.tensor(
              [[-float("inf"), -float("inf")], [0.0, 0.0]], **tkwargs
          )
          A = torch.ones(1, 2, **tkwargs)
          b = torch.tensor([[-2.0]], **tkwargs)
          sampler = LinearEllipticalSliceSampler(
              inequality_constraints=(A, b),
              bounds=bounds,
              mean=mean,
              covariance_matrix=covariance_matrix,
          )
          self.assertTrue(torch.equal(sampler._mean, mean))
          covar_root_xpct = torch.tensor(
              [[2.0, 0.0], [1.0, 1.0]], **tkwargs
          )
          self.assertTrue(
              torch.equal(sampler._covariance_root, covar_root_xpct)
          )
          samples = sampler.draw(n=3)
          self.assertEqual(samples.shape, torch.Size([3, 2]))
          self.assertTrue(sampler._is_feasible(samples.t()).all())
          self.assertFalse(torch.equal(sampler._x, sampler.x0))
  
file_path: botorch/test/utils/probability/test_lin_ess.py
imports: from __future__ import annotations
  import itertools
  import math
  from unittest.mock import patch
  import torch
  from botorch.exceptions.errors import BotorchError
  from botorch.utils.constraints import get_monotonicity_constraints
  from botorch.utils.probability.lin_ess import LinearEllipticalSliceSampler
  from botorch.utils.testing import BotorchTestCase
  from torch import Tensor
label_desc: Use image node_id 2 for calling the TestLinearEllipticalSliceSampler obj's underlying member method code with example usage: obj.test_bivariate() without return types