code: def test_stochastic_sampler(self):
      # Basic usage.
      samples = torch.rand(1, 2)
      posterior = MockPosterior(samples=samples)
      sampler = StochasticSampler(sample_shape=torch.Size([2]))
      self.assertTrue(
          torch.equal(samples.repeat(2, 1, 1), sampler(posterior))
      )
  
      # Test _update_base_samples.
      with self.assertRaisesRegex(
          NotImplementedError, "_update_base_samples"
      ):
          sampler._update_base_samples(
              posterior=posterior, base_sampler=sampler
          )
  
file_path: botorch/test/sampling/test_stochastic_samplers.py
imports: from unittest import mock
  import torch
  from botorch.posteriors.torch import TorchPosterior
  from botorch.sampling.stochastic_samplers import ForkedRNGSampler, StochasticSampler
  from botorch.utils.testing import BotorchTestCase, MockPosterior
  from torch.distributions.exponential import Exponential
label_desc: Use image node_id 1 for calling the TestStochasticSampler obj's underlying member method code with example usage: obj.test_stochastic_sampler() without return types