code: def test_convert_bounds_to_inequality_constraints(self):
      for dtype in (torch.float, torch.double):
          tkwargs = {"device": self.device, "dtype": dtype}
          # test basic case with no indefinite bounds
          lower_bounds = torch.rand(3, **tkwargs)
          upper_bounds = torch.rand_like(lower_bounds) + lower_bounds
          bounds = torch.stack([lower_bounds, upper_bounds], dim=0)
          A, b = _convert_bounds_to_inequality_constraints(
              bounds=bounds
          )
          identity = torch.eye(3, **tkwargs)
          self.assertTrue(torch.equal(A[:3], -identity))
          self.assertTrue(torch.equal(A[3:], identity))
          self.assertTrue(torch.equal(b[:3], -bounds[:1].t()))
          self.assertTrue(torch.equal(b[3:], bounds[1:].t()))
          # test filtering of indefinite bounds
          inf = float("inf")
          bounds = torch.tensor(
              [[-3.0, -inf, -inf], [inf, 2.0, inf]],
              **tkwargs,
          )
          A, b = _convert_bounds_to_inequality_constraints(
              bounds=bounds
          )
          A_xpct = torch.tensor(
              [[-1.0, -0.0, -0.0], [0.0, 1.0, 0.0]], **tkwargs
          )
          b_xpct = torch.tensor([[3.0], [2.0]], **tkwargs)
          self.assertTrue(torch.equal(A, A_xpct))
          self.assertTrue(torch.equal(b, b_xpct))
  
imports: from __future__ import annotations
  import itertools
  import warnings
  from typing import Any, Dict, Type
  from unittest import mock
  import numpy
  import torch
  from botorch.exceptions.errors import BotorchError
  from botorch.models.gp_regression import SingleTaskGP
  from botorch.sampling.pathwise import draw_matheron_paths
  from botorch.utils.sampling import _convert_bounds_to_inequality_constraints, batched_multinomial, DelaunayPolytopeSampler, draw_sobol_samples, find_interior_point, get_polytope_samples, HitAndRunPolytopeSampler, manual_seed, normalize_linear_constraints, optimize_posterior_samples, PolytopeSampler, sample_hypersphere, sample_simplex, sparse_to_dense_constraints
  from botorch.utils.testing import BotorchTestCase
label_desc: Use image node_id 5 for calling the TestSampleUtils obj's underlying member method code with example usage: obj.test_convert_bounds_to_inequality_constraints() without return types