code: def check_model(
      model: ModelProto | str | bytes | os.PathLike,
      full_check: bool = False,
      skip_opset_compatibility_check: bool = False,
  ) -> None:
      """Check the consistency of a model.
  
      An exception will be raised if the model's ir_version is not set
      properly or is higher than checker's ir_version, or if the model
      has duplicate keys in metadata_props.
  
      If IR version >= 3, the model must specify opset_import.
      If IR version < 3, the model cannot have any opset_import specified.
  
      Args:
          model: Model to check. If model is a path, the function checks model
              path first. If the model bytes size is larger than 2GB, function
              should be called using model path.
          full_check: If True, the function also runs shape inference check.
          skip_opset_compatibility_check: If True, the function skips the check for
              opset compatibility.
      """
      # If model is a path instead of ModelProto
      if isinstance(model, (str, os.PathLike)):
          C.check_model_path(
              os.fspath(model),
              full_check,
              skip_opset_compatibility_check,
          )
      else:
          protobuf_string = (
              model
              if isinstance(model, bytes)
              else model.SerializeToString()
          )
          # If the protobuf is larger than 2GB,
          # remind users should use the model path to check
          if sys.getsizeof(protobuf_string) > MAXIMUM_PROTOBUF:
              raise ValueError(
                  "This protobuf of onnx model is too large (>2GB). Call check_model with model path instead."
              )
          C.check_model(
              protobuf_string,
              full_check,
              skip_opset_compatibility_check,
          )
  
file_path: onnx/onnx/checker.py
imports: from __future__ import annotations
  import os
  import sys
  from typing import Any, Callable, TypeVar
  from google.protobuf.message import Message
  import onnx.defs
  import onnx.onnx_cpp2py_export.checker
  import onnx.shape_inference
  from onnx import IR_VERSION, AttributeProto, FunctionProto, GraphProto, ModelProto, NodeProto, SparseTensorProto, TensorProto, ValueInfoProto
label_desc: Use image node_id 9 for calling a global function with example usage: check_model(model, full_check, skip_opset_compatibility_check) without return types