code: def grid_parameters(
      parameters: Dict[str, Iterable[Any]],
      yield_dict: bool = False,
      add_test_name: bool = True,
      filter_params_func: Optional[Callable[[Tuple], Tuple]] = None,
  ) -> Iterable:
      """
      Generates an iterable over the grid of all combinations of parameters.
  
      Args:
          `parameters` (`Dict[str, Iterable[Any]]`):
              Dictionary of multiple values to generate a grid from.
          `yield_dict` (`bool`, defaults to `False`):
              If True, a dictionary with all keys, and sampled values will be returned. Otherwise, return sampled values as a list.
          `add_test_name` (`bool`, defaults to `True`):
              Whether to add the test name in the yielded list or dictionary.
          filter_params_func (`Optional[Callable[[Tuple], Tuple]]`, defaults to `None`):
              A function that can modify or exclude the current set of parameters. The function should take a tuple of the
              parameters and return the same. If a parameter set is to be excluded, the function should return an empty tuple.
      """
      for params in itertools.product(*parameters.values()):
          if filter_params_func is not None:
              params = filter_params_func(list(params))
              if params is None:
                  continue
  
          test_name = "_".join([str(param) for param in params])
          if yield_dict is True:
              res_dict = {}
              for i, key in enumerate(parameters.keys()):
                  res_dict[key] = params[i]
              if add_test_name is True:
                  res_dict["test_name"] = test_name
              yield res_dict
          else:
              returned_list = (
                  [test_name] + list(params)
                  if add_test_name is True
                  else list(params)
              )
              yield returned_list
  
imports: import importlib.util
  import itertools
  import os
  import subprocess
  import sys
  import unittest
  from collections.abc import MutableMapping
  from typing import Any, Callable, Dict, Iterable, Optional, Tuple
  import torch
  from .None import is_accelerate_available, is_auto_gptq_available, is_diffusers_available, is_sentence_transformers_available, is_timm_available
label_desc: Use image node_id 13 for calling a global function with example usage: grid_parameters(parameters, yield_dict, add_test_name, filter_params_func) without return types