pub fn read_model_binary(path: impl AsRef<Path>) -> Result<Vec<u8>, LoaderError>Expand description
Read a model file into the binary protobuf bytes of its ModelProto.
Detection is by filename suffix: a path ending in .textproto is parsed as
ONNX protobuf TextFormat and converted to the binary wire encoding (see
proto::textproto_to_binary); any other path is read verbatim as an
already-binary .onnx model. This is the single seam that lets every
path-based loader entry accept git-friendly textproto fixtures while keeping
binary .onnx loading unchanged.
Path-based callers still pass this file’s parent directory to the weight loader, so TextFormat graphs may reference external initializer data just like binary ONNX graphs.