code: def combinations(
      module: Mutable | nn.Module, input_shape: tuple[MutableShape, ...]
  ) -> Iterable[tuple[MutableExpression[bool] | bool, Any, Any]]:
      """List all the combinations of the (mutable) module and the input shape.
  
      The returned iterator yields a tuple of (sample, module, input) for each combination.
      The inputs will be generated with :func:`torch.randn` based on the sampled input shape.
  
      The module can be potentially not any mutable object.
      If the module is not a ``Mutable``, it must be a ``nn.Module`` so that it can be wrapped with a MutableModule.
      """
      from torch.utils._pytree import tree_flatten, tree_unflatten
  
      if not isinstance(module, Mutable):
          module = _mutable_module_wrapper(module)
      input_shape_flattened, input_shape_spec = tree_flatten(
          input_shape
      )
      all_mutables = MutableList([module] + input_shape_flattened)
  
      _logger.debug(
          "Search space for current module: %s", module.simplify()
      )
      _logger.debug(
          "Search space for current input shape: %s",
          MutableList(input_shape_flattened).simplify(),
      )
  
      sample = {}
      for mutables in all_mutables.grid(memo=sample):
          sampled_module = mutables[0]
          if isinstance(sampled_module, _mutable_module_wrapper):
              sampled_module = sampled_module.module
          example_inputs_flattened = [
              torch.randn(*shape)
              if isinstance(shape, torch.Size)
              else shape
              for shape in mutables[1:]
          ]
          sampled_input = tree_unflatten(
              example_inputs_flattened, input_shape_spec
          )
          yield sample_to_condition(
              all_mutables.simplify(), sample
          ), sampled_module, sampled_input
  
imports: from __future__ import annotations
  import functools
  import logging
  import tempfile
  from typing import Any, Iterable
  import torch
  from torch import nn
  from nn_meter import load_latency_predictor, nnMeterPredictor
  from nni.mutable import Mutable, MutableList, LabeledMutable, Sample, MutableExpression
  from nni.nas.nn.pytorch import ModelSpace, MutableModule, LayerChoice, Repeat
  from nni.nas.profiler import ExpressionProfiler
  from .utils import MutableShape, ShapeTensor, standardize_arguments, submodule_input_output_shapes, is_leaf_module, concat_name
label_desc: Use image node_id 3 for calling a global function with example usage: combinations(module, input_shape) without return types