code: def test_forked_rng_sampler(self):
      posterior = TorchPosterior(Exponential(rate=torch.rand(1, 2)))
      sampler = ForkedRNGSampler(sample_shape=torch.Size([2]), seed=0)
      with mock.patch.object(
          posterior.distribution,
          "rsample",
          wraps=posterior.distribution.rsample,
      ) as mock_rsample:
          samples = sampler(posterior)
      mock_rsample.assert_called_once_with(sample_shape=torch.Size([2]))
      with torch.random.fork_rng():
          torch.manual_seed(0)
          expected = posterior.rsample(sample_shape=torch.Size([2]))
      self.assertAllClose(samples, expected)
  
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 TestForkedRNGSampler obj's underlying member method code with example usage: obj.test_forked_rng_sampler() without return types