code: def infer_shapes(
      model: Union[ModelProto, bytes],
      check_type: bool = False,
      strict_mode: bool = False,
      data_prop: bool = False,
  ) -> ModelProto:
      """Apply shape inference to the provided ModelProto.
  
      Inferred shapes are added to the value_info field of the graph.
  
      If the inferred values conflict with values already provided in the
      graph, that means that the provided values are invalid (or there is a
      bug in shape inference), and the result is unspecified.
  
      Arguments:
          model (Union[ModelProto, bytes], bool, bool, bool) -> ModelProto
          check_type (bool): Checks the type-equality for input and output
          strict_mode (bool): Stricter shape inference, it will throw errors if any;
              Otherwise, simply stop if any error
          data_prop (bool): Enables data propagation for limited operators to perform shape computation
  
      Returns:
          (ModelProto) model with inferred shape information
      """
      if isinstance(model, (ModelProto, bytes)):
          model_str = (
              model
              if isinstance(model, bytes)
              else model.SerializeToString()
          )
          inferred_model_str = C.infer_shapes(
              model_str, check_type, strict_mode, data_prop
          )
          return onnx.load_from_string(inferred_model_str)
      if isinstance(model, str):
          raise TypeError(
              "infer_shapes only accepts ModelProto or bytes,"
              "you can use infer_shapes_path for the model path (String)."
          )
  
      raise TypeError(
          f"infer_shapes only accepts ModelProto or bytes, incorrect type: {type(model)}"
      )
  
file_path: catboost/contrib/libs/onnx/onnx/shape_inference.py
imports: from typing import Dict, List, Optional, Sequence, Union
  import onnx
  from onnx.onnx_cpp2py_export import shape_inference
  from onnx import AttributeProto, FunctionProto, ModelProto, TypeProto
label_desc: Use image node_id 1 for calling a global function with example usage: infer_shapes(model, check_type, strict_mode, data_prop) and returns: onnx