code: def _test_draw_matheron_paths(
      self, model, paths, sample_shape, atol=3
  ):
      (train_X,) = get_train_inputs(model, transformed=False)
      X = torch.rand(
          16, train_X.shape[-1], dtype=train_X.dtype, device=self.device
      )
  
      # Evaluate sample paths and compute sample statistics
      samples = paths(X)
      batch_shape = (
          model.model.covar_module.batch_shape
          if isinstance(model, SingleTaskVariationalGP)
          else model.covar_module.batch_shape
      )
      self.assertEqual(
          samples.shape, sample_shape + batch_shape + X.shape[-2:-1]
      )
  
      sample_moments = get_sample_moments(samples, sample_shape)
      if hasattr(model, "outcome_transform"):
          # Do this instead of untransforming exact moments
          sample_moments = standardize_moments(
              model.outcome_transform, *sample_moments
          )
  
      if model.training:
          model.eval()
          mvn = model(model.transform_inputs(X))
          model.train()
      else:
          mvn = model(model.transform_inputs(X))
      exact_moments = (mvn.loc, mvn.covariance_matrix)
  
      # Compare moments
      num_features = paths["prior_paths"].weight.shape[-1]
      tol = atol * (num_features**-0.5 + sample_shape.numel() ** -0.5)
      for exact, estimate in zip(exact_moments, sample_moments):
          self.assertTrue(exact.allclose(estimate, atol=tol, rtol=0))
  
file_path: botorch/test/sampling/pathwise/test_posterior_samplers.py
imports: from __future__ import annotations
  from copy import deepcopy
  import torch
  from botorch.models import ModelListGP, SingleTaskGP, SingleTaskVariationalGP
  from botorch.models.transforms.input import Normalize
  from botorch.models.transforms.outcome import Standardize
  from botorch.sampling.pathwise import draw_matheron_paths, MatheronPath, PathList
  from botorch.sampling.pathwise.utils import get_train_inputs
  from botorch.utils.test_helpers import get_sample_moments, standardize_moments
  from botorch.utils.testing import BotorchTestCase
  from gpytorch.kernels import MaternKernel, ScaleKernel
  from torch import Size
  from torch.nn.functional import pad
label_desc: Use image node_id 3 for calling the TestPosteriorSamplers obj's underlying member method code with example usage: obj._test_draw_matheron_paths(model, paths, sample_shape, atol) without return types