class_docstr: Flatten nested collection types and return a flat list of elements.
  
  ONNX can't represent collection types (e.g., dictionary, tuple of tuple of tensor,
  etc).
  
  This class stores the `SpecTree` output produced when `adapt` was called the first
  time. It then validates the `SpecTree` output produced from later `adapt` calls.
class_docstr_tok: ["Flatten","nested","collection","types","and","return","a","flat","list","of","elements",".","ONNX","ca","n't","represent","collection","types","(","e.g.",",","dictionary",",","tuple","of","tuple","of","tensor",",","etc",")",".","This","class","stores","the","`","SpecTree","`","output","produced","when","`","adapt","`","was","called","the","first","time",".","It","then","validates","the","`","SpecTree","`","output","produced","from","later","`","adapt","`","calls","."]
docstr: Flatten the model args and kwargs and validate the `SpecTree` output.
  
  Args:
      model_args: The model args.
      model_kwargs: The model kwargs.
      model: The PyTorch model.
  
  Returns:
      A tuple of the flattened model args and kwargs. The kwargs is empty, because
      they are flattened and merged into the args.
  
  Raises:
      ValueError: If the `SpecTree` output produced from the current `model_outputs`
          is not identical to the `SpecTree` output produced from the first
          `model_outputs` that was passed to this method.
code: def apply(
      self,
      model_args: Sequence[Any],
      model_kwargs: Mapping[str, Any],
      model: Optional[
          Union[torch.nn.Module, Callable, torch_export.ExportedProgram]
      ] = None,
  ) -> Tuple[Sequence[Any], Mapping[str, Any]]:
      """Flatten the model args and kwargs and validate the `SpecTree` output.
  
      Args:
          model_args: The model args.
          model_kwargs: The model kwargs.
          model: The PyTorch model.
  
      Returns:
          A tuple of the flattened model args and kwargs. The kwargs is empty, because
          they are flattened and merged into the args.
  
      Raises:
          ValueError: If the `SpecTree` output produced from the current `model_outputs`
              is not identical to the `SpecTree` output produced from the first
              `model_outputs` that was passed to this method.
      """
      flattened_args, spec = pytree.tree_flatten(
          (model_args, model_kwargs)
      )
      if self._spec is None:
          self._spec = spec
      else:
          _assert_identical_pytree_spec(
              self._spec,
              spec,
              error_message="Model inputs incompatible with the format that was exported. ",
          )
      return flattened_args, {}
  
imports: from __future__ import annotations
  import inspect
  from typing import Any, Callable, List, Mapping, Optional, Protocol, runtime_checkable, Sequence, Tuple, Union
  import torch
  import torch.export
  from torch.onnx._internal import _beartype
  from torch.utils import _pytree
label_desc: Use image node_id 1 for calling the FlattenInputWithTreeSpecValidationInputStep obj's underlying member method code with example usage: obj.apply(model_args, model_kwargs, model) and returns: flattened_args,  dict