#![allow(unused_doc_comments)]
pub mod model;
use anyhow::{anyhow, Result};
pub use model::*;
mod processors;
use processors::*;
mod pbtxt;
use pbtxt::*;
pub mod dot;
use dot::*;
mod dispatch;
pub use dispatch::{FileType, FileType::*};
pub mod str_ext;
pub use str_ext::StrExt;
pub mod string_ext;
pub mod om_json;
mod serde_helper;
pub use string_ext::SmartStringExt;
use crate::om_json::parse_om_json;
pub type StdString = String;
pub fn parse_bin(path: &str) -> Result<Model> {
match FileType::from(path) {
ONNX => parse_onnx(path),
MindIR => parse_mindir(path),
GeIR => parse_geir(path),
PBTXT => {
let mut model = parse_onnx_pbtxt(path)?;
model.populate_node_connections();
Ok(model)
},
DOT => {
let content = read_dot(path)?;
let model = parse_dot(&content)?;
Ok(model)
},
OmJson => {
let mut model = parse_om_json(path)?;
model.populate_node_connections();
Ok(model)
}
Unsupported => Err(anyhow!(format!("Unsupported FileType: {path:?}"))),
}
}