code: def validate_model_outputs(
      config: OnnxConfig,
      reference_model: Union[
          "PreTrainedModel", "TFPreTrainedModel", "ModelMixin"
      ],
      onnx_model: Path,
      onnx_named_outputs: List[str],
      atol: Optional[float] = None,
      input_shapes: Optional[Dict] = None,
      device: str = "cpu",
      dtype: Optional["torch.dtype"] = None,
      use_subprocess: Optional[bool] = True,
      model_kwargs: Optional[Dict[str, Any]] = None,
  ):
      """
      Validates the export by checking that the outputs from both the reference and the exported model match.
      Args:
          config ([`~OnnxConfig`]:
              The configuration used to export the model.
          reference_model ([`~PreTrainedModel`] or [`~TFPreTrainedModel`]):
              The model used for the export.
          onnx_model (`Path`):
              The path to the exported model.
          onnx_named_outputs (`List[str]`):
              The names of the outputs to check.
          atol (`Optional[float]`, defaults to `None`):
              The absolute tolerance in terms of outputs difference between the reference and the exported model.
          input_shapes (`Optional[Dict]`, defaults to `None`):
              If specified, allows to use specific shapes to validate the ONNX model on.
          device (`str`, defaults to `"cpu"`):
              The device on which the ONNX model will be validated. Either `cpu` or `cuda`. Validation on a CUDA device is supported only for PyTorch.
          use_subprocess (`Optional[bool]`, defaults to `True`):
              Launch validation of each exported model in a subprocess.
          model_kwargs (`Optional[Dict[str, Any]]`, defaults to `None`):
              Experimental usage: keyword arguments to pass to the model during
              the export and validation.
      Raises:
          ValueError: If the outputs shapes or values do not match between the reference and the exported model.
      """
      if use_subprocess:
          # InferenceSession do not support the fork start method with some EP: https://github.com/microsoft/onnxruntime/issues/7846
          mp.set_start_method("spawn", force=True)
  
          io_process = ValidationProcess(
              config,
              reference_model,
              onnx_model,
              onnx_named_outputs,
              atol,
              input_shapes,
              device,
              dtype,
              model_kwargs,
          )
          io_process.start()
          io_process.join()
  
          if io_process.exception:
              error, traceback = io_process.exception
              raise error
      else:
          _run_validation(
              config,
              reference_model,
              onnx_model,
              onnx_named_outputs,
              atol,
              input_shapes,
              device,
              dtype,
              model_kwargs=model_kwargs,
          )
  
imports: import copy
  import gc
  import multiprocessing
  import os
  import traceback
  from inspect import signature
  from itertools import chain
  from pathlib import Path
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  import numpy
  import onnx
  from transformers.utils import is_tf_available, is_torch_available
  from ...onnx.utils import _get_onnx_external_data_tensors, check_model_uses_external_data
  from ...utils import TORCH_MINIMUM_VERSION, is_diffusers_available, is_torch_onnx_support_available, logging, require_numpy_strictly_lower
  from ..error_utils import AtolError, MinimumVersionError, OutputMatchError, ShapeError
  from .base import OnnxConfig
  from .model_configs import SpeechT5OnnxConfig
  from .utils import PickableInferenceSession, recursive_to_device
label_desc: Use image node_id 3 for calling a global function with example usage: validate_model_outputs(config, reference_model, onnx_model, onnx_named_outputs, atol, input_shapes, device, dtype, use_subprocess, model_kwargs) without return types