INNER CODE UNIT · Rust
onnx
sonos/tract · api/proxy/src/lib.rs:61
pub fn onnx() -> Result<Onnx> {
let mut onnx = null_mut();
check!(sys::tract_onnx_create(&mut onnx))?;
Ok(Onnx(onnx))
}
pub fn version() -> &'static str {
unsafe { CStr::from_ptr(sys::tract_version()).to_str().unwrap() }
}
wrapper!(Nnef, TractNnef, tract_nnef_destroy);
impl NnefInterface for Nnef {
type Model = Model;
fn load(&self, path: impl AsRef<Path>) -> Result<Model> {
let path = path.as_ref();
let path = CString::new(
path.to_str().with_context(|| format!("Failed to re-encode {path:?} to uff-8"))?,
)?;