prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Make C++ and Python checker API consistent
  Python checker API supports `full_check` arg:
  https://github.com/onnx/onnx/blob/fa6f8cfdce3d86346e8a7494f3062b98416c85fb/onnx/checker.py#L94
  
  C++ does not.
  It'd be nice for them to be consistent.
  
  </issue>
  <code>
  [start of onnx/checker.py]
  1 # SPDX-License-Identifier: Apache-2.0
  2 """onnx checker
  3 
  4 This implements graphalities that allows us to check whether a serialized
  5 proto is legal.
  6 """
  7 
  8 import functools
  9 
  10 from onnx import (ValueInfoProto,
  11                   AttributeProto,
  12                   TensorProto,
  13                   SparseTensorProto,
  14                   NodeProto,
  15                   ModelProto,
  16                   GraphProto,
  17                   IR_VERSION)
  18 import onnx.onnx_cpp2py_export.checker as C
  19 import onnx.defs
  20 from google.protobuf.message import Message
  21 from typing import TypeVar, Callable, Any, Type, cast, Union
  22 import onnx.shape_inference
  23 import sys
  24 
  25 
  26 # Limitation of single protobuf file is 2GB
  27 MAXIMUM_PROTOBUF = 2000000000
  28 
  29 # TODO: This thing where we reserialize the protobuf back into the
  30 # string, only to deserialize it at the call site, is really goofy.
  31 # Stop doing that.
  32 
  33 
  34 # NB: Please don't edit this context!
  35 DEFAULT_CONTEXT = C.CheckerContext()
  36 DEFAULT_CONTEXT.ir_version = IR_VERSION
  37 # TODO: Maybe ONNX-ML should also be defaulted?
  38 DEFAULT_CONTEXT.opset_imports = {'': onnx.defs.onnx_opset_version()}
  39 
  40 
  41 FuncType = TypeVar('FuncType', bound=Callable[..., Any])
  42 
  43 
  44 # TODO: This really doesn't seem worth the metaprogramming...
  45 def _create_checker(proto_type: Type[Message]) -> Callable[[FuncType], FuncType]:
  46     def decorator(py_func: FuncType) -> FuncType:
  47         @functools.wraps(py_func)
  48         def checker(proto: Message, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> Any:
  49             if not isinstance(proto, proto_type):
  50                 raise RuntimeError(
  51                     'You cannot pass an object that is not of type {}'.format(
  52                         proto_type.__name__))
  53             return getattr(C, py_func.__name__)(
  54                 proto.SerializeToString(), ctx)
  55         return cast(FuncType, checker)
  56     return decorator
  57 
  58 
  59 @_create_checker(ValueInfoProto)
  60 def check_value_info(value_info: ValueInfoProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:
  61     pass
  62 
  63 
  64 @_create_checker(TensorProto)
  65 def check_tensor(tensor: TensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:
  66     pass
  67 
  68 
  69 @_create_checker(AttributeProto)
  70 def check_attribute(attr: AttributeProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:
  71     pass
  72 
  73 
  74 @_create_checker(NodeProto)
  75 def check_node(node: NodeProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:
  76     pass
  77 
  78 
  79 @_create_checker(GraphProto)
  80 def check_graph(graph: GraphProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:
  81     pass
  82 
  83 
  84 def check_sparse_tensor(sparse: SparseTensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:
  85     C.check_sparse_tensor(sparse.SerializeToString(), ctx)
  86 
  87 
  88 def check_model(model: Union[ModelProto, str, bytes], full_check: bool = False) -> None:
  89     """Check the consistency of a model. An exception is raised if the test fails.
  90 
  91     Arguments:
  92         model (ModelProto): model to check
  93         full_check (bool): if True, the function checks shapes can be inferred
  94     """
  95     # If model is a path instead of ModelProto
  96     if isinstance(model, str):
  97         C.check_model_path(model)
  98         if full_check:
  99             onnx.shape_inference.infer_shapes_path(model, check_type=True, strict_mode=True)
  100     else:
  101         protobuf_string = model if isinstance(model, bytes) else model.SerializeToString()
  102         # If the protobuf is larger than 2GB,
  103         # remind users should use the model path to check
  104         if sys.getsizeof(protobuf_string) > MAXIMUM_PROTOBUF:
  105             raise ValueError('This protobuf of onnx model is too large (>2GB). Call check_model with model path instead.')
  106         C.check_model(protobuf_string)
  107         if full_check:
  108             onnx.shape_inference.infer_shapes(model, check_type=True, strict_mode=True)
  109 
  110 
  111 ValidationError = C.ValidationError
  112
  [end of onnx/checker.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/onnx/checker.py b/onnx/checker.py
  --- a/onnx/checker.py
  +++ b/onnx/checker.py
  @@ -94,18 +94,14 @@
       """
       # If model is a path instead of ModelProto
       if isinstance(model, str):
  -        C.check_model_path(model)
  -        if full_check:
  -            onnx.shape_inference.infer_shapes_path(model, check_type=True, strict_mode=True)
  +        C.check_model_path(model, full_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)
  -        if full_check:
  -            onnx.shape_inference.infer_shapes(model, check_type=True, strict_mode=True)
  +        C.check_model(protobuf_string, full_check)
   
   
   ValidationError = C.ValidationError
  
verification_info: {"golden_diff": "diff --git a/onnx/checker.py b/onnx/checker.py\n--- a/onnx/checker.py\n+++ b/onnx/checker.py\n@@ -94,18 +94,14 @@\n     \"\"\"\n     # If model is a path instead of ModelProto\n     if isinstance(model, str):\n-        C.check_model_path(model)\n-        if full_check:\n-            onnx.shape_inference.infer_shapes_path(model, check_type=True, strict_mode=True)\n+        C.check_model_path(model, full_check)\n     else:\n         protobuf_string = model if isinstance(model, bytes) else model.SerializeToString()\n         # If the protobuf is larger than 2GB,\n         # remind users should use the model path to check\n         if sys.getsizeof(protobuf_string) > MAXIMUM_PROTOBUF:\n             raise ValueError('This protobuf of onnx model is too large (>2GB). Call check_model with model path instead.')\n-        C.check_model(protobuf_string)\n-        if full_check:\n-            onnx.shape_inference.infer_shapes(model, check_type=True, strict_mode=True)\n+        C.check_model(protobuf_string, full_check)\n \n \n ValidationError = C.ValidationError\n", "issue": "Make C++ and Python checker API consistent\nPython checker API supports `full_check` arg:\r\nhttps://github.com/onnx/onnx/blob/fa6f8cfdce3d86346e8a7494f3062b98416c85fb/onnx/checker.py#L94\r\n\r\nC++ does not.\r\nIt'd be nice for them to be consistent.\n", "before_files": [{"content": "# SPDX-License-Identifier: Apache-2.0\n\"\"\"onnx checker\n\nThis implements graphalities that allows us to check whether a serialized\nproto is legal.\n\"\"\"\n\nimport functools\n\nfrom onnx import (ValueInfoProto,\n                  AttributeProto,\n                  TensorProto,\n                  SparseTensorProto,\n                  NodeProto,\n                  ModelProto,\n                  GraphProto,\n                  IR_VERSION)\nimport onnx.onnx_cpp2py_export.checker as C\nimport onnx.defs\nfrom google.protobuf.message import Message\nfrom typing import TypeVar, Callable, Any, Type, cast, Union\nimport onnx.shape_inference\nimport sys\n\n\n# Limitation of single protobuf file is 2GB\nMAXIMUM_PROTOBUF = 2000000000\n\n# TODO: This thing where we reserialize the protobuf back into the\n# string, only to deserialize it at the call site, is really goofy.\n# Stop doing that.\n\n\n# NB: Please don't edit this context!\nDEFAULT_CONTEXT = C.CheckerContext()\nDEFAULT_CONTEXT.ir_version = IR_VERSION\n# TODO: Maybe ONNX-ML should also be defaulted?\nDEFAULT_CONTEXT.opset_imports = {'': onnx.defs.onnx_opset_version()}\n\n\nFuncType = TypeVar('FuncType', bound=Callable[..., Any])\n\n\n# TODO: This really doesn't seem worth the metaprogramming...\ndef _create_checker(proto_type: Type[Message]) -> Callable[[FuncType], FuncType]:\n    def decorator(py_func: FuncType) -> FuncType:\n        @functools.wraps(py_func)\n        def checker(proto: Message, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> Any:\n            if not isinstance(proto, proto_type):\n                raise RuntimeError(\n                    'You cannot pass an object that is not of type {}'.format(\n                        proto_type.__name__))\n            return getattr(C, py_func.__name__)(\n                proto.SerializeToString(), ctx)\n        return cast(FuncType, checker)\n    return decorator\n\n\n@_create_checker(ValueInfoProto)\ndef check_value_info(value_info: ValueInfoProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:\n    pass\n\n\n@_create_checker(TensorProto)\ndef check_tensor(tensor: TensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:\n    pass\n\n\n@_create_checker(AttributeProto)\ndef check_attribute(attr: AttributeProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:\n    pass\n\n\n@_create_checker(NodeProto)\ndef check_node(node: NodeProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:\n    pass\n\n\n@_create_checker(GraphProto)\ndef check_graph(graph: GraphProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:\n    pass\n\n\ndef check_sparse_tensor(sparse: SparseTensorProto, ctx: C.CheckerContext = DEFAULT_CONTEXT) -> None:\n    C.check_sparse_tensor(sparse.SerializeToString(), ctx)\n\n\ndef check_model(model: Union[ModelProto, str, bytes], full_check: bool = False) -> None:\n    \"\"\"Check the consistency of a model. An exception is raised if the test fails.\n\n    Arguments:\n        model (ModelProto): model to check\n        full_check (bool): if True, the function checks shapes can be inferred\n    \"\"\"\n    # If model is a path instead of ModelProto\n    if isinstance(model, str):\n        C.check_model_path(model)\n        if full_check:\n            onnx.shape_inference.infer_shapes_path(model, check_type=True, strict_mode=True)\n    else:\n        protobuf_string = model if isinstance(model, bytes) else model.SerializeToString()\n        # If the protobuf is larger than 2GB,\n        # remind users should use the model path to check\n        if sys.getsizeof(protobuf_string) > MAXIMUM_PROTOBUF:\n            raise ValueError('This protobuf of onnx model is too large (>2GB). Call check_model with model path instead.')\n        C.check_model(protobuf_string)\n        if full_check:\n            onnx.shape_inference.infer_shapes(model, check_type=True, strict_mode=True)\n\n\nValidationError = C.ValidationError\n", "path": "onnx/checker.py"}]}