code: def get_parameters_and_bounds(
      module: Module,
      requires_grad: Optional[bool] = None,
      name_filter: Optional[Callable[[str], bool]] = None,
      default_bounds: Tuple[float, float] = (
          -float("inf"),
          float("inf"),
      ),
  ) -> Tuple[
      Dict[str, Tensor],
      Dict[str, Tuple[Optional[float], Optional[float]]],
  ]:
      r"""Helper method for obtaining a module's parameters and their respective ranges.
  
      Args:
          module: The target module from which parameters are to be extracted.
          name_filter: Optional Boolean function used to filter parameters by name.
          requires_grad: Optional Boolean used to filter parameters based on whether
              or not their require_grad attribute matches the user provided value.
          default_bounds: Default lower and upper bounds for constrained parameters
              with `None` typed bounds.
  
      Returns:
          A dictionary of parameters and a dictionary of parameter bounds.
      """
      if hasattr(module, "named_parameters_and_constraints"):
          bounds = {}
          params = {}
          for (
              name,
              param,
              constraint,
          ) in module.named_parameters_and_constraints():
              if (
                  requires_grad is None
                  or (param.requires_grad == requires_grad)
              ) and (name_filter is None or name_filter(name)):
                  params[name] = param
                  if constraint is None:
                      continue
  
                  bounds[name] = tuple(
                      default
                      if bound is None
                      else constraint.inverse_transform(bound)
                      for (bound, default) in zip(
                          constraint, default_bounds
                      )
                  )
  
          return params, bounds
  
      params = get_parameters(
          module, requires_grad=requires_grad, name_filter=name_filter
      )
      return params, {}
  
file_path: botorch/botorch/optim/utils/model_utils.py
imports: from __future__ import annotations
  from re import Pattern
  from typing import Any, Callable, Dict, Iterator, NamedTuple, Optional, Tuple, Union
  from warnings import warn
  import torch
  from botorch.exceptions.warnings import BotorchWarning
  from botorch.models.gpytorch import GPyTorchModel
  from torch import Tensor
  from torch.nn import Module
  from torch.utils.data import DataLoader, TensorDataset
label_desc: Use image node_id 3 for calling a global function with example usage: get_parameters_and_bounds(module, requires_grad, name_filter, default_bounds) and returns: params,  dict, params,  bounds