code: def test_build_positional_indices(self):
      with torch.random.fork_rng():
          torch.random.manual_seed(0)
          values = torch.rand(3, 2, 5)
  
      for dim in (values.ndim, -values.ndim - 1):
          with self.assertRaisesRegex(
              ValueError, r"dim=(-?\d+) invalid for shape"
          ):
              utils.build_positional_indices(
                  shape=values.shape, dim=dim
              )
  
      start = utils.build_positional_indices(shape=values.shape, dim=-2)
      self.assertEqual(start.shape, values.shape[:-1])
      self.assertTrue(start.remainder(values.shape[-1]).eq(0).all())
  
      max_values, max_indices = values.max(dim=-1)
      self.assertTrue(
          values.view(-1)[start + max_indices].equal(max_values)
      )
  
file_path: botorch/test/utils/probability/test_utils.py
imports: from __future__ import annotations
  import torch
  from botorch.utils.probability import ndtr, utils
  from botorch.utils.probability.utils import log_erfc, log_erfcx, log_ndtr, log_phi, log_prob_normal_in, phi, standard_normal_log_hazard
  from botorch.utils.testing import BotorchTestCase
  from numpy.polynomial.legendre import leggauss
label_desc: Use image node_id 2 for calling the TestProbabilityUtils obj's underlying member method code with example usage: obj.test_build_positional_indices() without return types