code: def test_get_parameters(self):
      self.assertEqual(
          0, len(get_parameters(self.module, requires_grad=False))
      )
  
      # No name filter
      for name_filter in [None, lambda x: "n" in x]:
          with self.subTest("none filtered", name_filter=name_filter):
              params = get_parameters(
                  self.module, name_filter=name_filter
              )
              self.assertEqual(1, len(params))
              self.assertEqual(
                  next(iter(params)), "noise_covar.raw_noise"
              )
              self.assertTrue(
                  self.module.noise_covar.raw_noise.equal(
                      next(iter(params.values()))
                  )
              )
  
      with self.subTest("all params filtered"):
          params = get_parameters(
              self.module, name_filter=lambda x: "z" in x
          )
          self.assertEqual(params, {})
  
          params = get_parameters(
              self.module, name_filter=lambda x: "n" in x
          )
          self.assertEqual(1, len(params))
          self.assertEqual(next(iter(params)), "noise_covar.raw_noise")
  
          # requires_grad case
          params = get_parameters(
              self.module,
              requires_grad=False,
              name_filter=lambda x: "n" in x,
          )
          self.assertEqual(params, {})
  
imports: from __future__ import annotations
  import re
  import warnings
  from copy import deepcopy
  from string import ascii_lowercase
  from unittest.mock import MagicMock, patch
  import torch
  from botorch import settings
  from botorch.models import SingleTaskGP
  from botorch.optim.utils import get_data_loader, get_name_filter, get_parameters, get_parameters_and_bounds, model_utils, sample_all_priors
  from botorch.utils.testing import BotorchTestCase
  from gpytorch.constraints import GreaterThan
  from gpytorch.kernels.matern_kernel import MaternKernel
  from gpytorch.kernels.scale_kernel import ScaleKernel
  from gpytorch.likelihoods import GaussianLikelihood
  from gpytorch.mlls.exact_marginal_log_likelihood import ExactMarginalLogLikelihood
  from gpytorch.priors import UniformPrior
  from gpytorch.priors.prior import Prior
  from gpytorch.priors.torch_priors import GammaPrior
label_desc: Use image node_id 2 for calling the TestGetParameters obj's underlying member method code with example usage: obj.test_get_parameters() without return types