class_docstr: Serialize and deserialize the ONNX textual representation.
class_docstr_tok: ["Serialize","and","deserialize","the","ONNX","textual","representation","."]
code: def deserialize_proto(
      self, serialized: bytes | str, proto: _Proto
  ) -> _Proto:
      warnings.warn(
          "The onnxtxt format is experimental. Please report any errors to the ONNX GitHub repository.",
          stacklevel=2,
      )
      if not isinstance(serialized, (bytes, str)):
          raise TypeError(
              f"Parameter 'serialized' must be bytes or str, but got type: {type(serialized)}"
          )
      if isinstance(serialized, bytes):
          text = serialized.decode(_ENCODING)
      else:
          text = serialized
      if isinstance(proto, onnx.ModelProto):
          return onnx.parser.parse_model(text)  # type: ignore[return-value]
      if isinstance(proto, onnx.GraphProto):
          return onnx.parser.parse_graph(text)  # type: ignore[return-value]
      if isinstance(proto, onnx.FunctionProto):
          return onnx.parser.parse_function(text)  # type: ignore[return-value]
      if isinstance(proto, onnx.NodeProto):
          return onnx.parser.parse_node(text)  # type: ignore[return-value]
      raise ValueError(f"Unsupported proto type: {type(proto)}")
  
imports: from __future__ import annotations
  import warnings
  import typing
  from typing import Any, Collection, Optional, Protocol, TypeVar
  import google.protobuf.json_format
  import google.protobuf.message
  import google.protobuf.text_format
  import onnx
label_desc: Use image node_id 2 for calling the _TextualSerializer obj's underlying member method code with example usage: obj.deserialize_proto(serialized, proto) and returns: onnx, onnx, onnx, onnx