INNER CODE UNIT · Rust

m

sonos/tract · api/ffi/src/lib.rs:311

        let m = Box::new(TractInferenceModel((*onnx).0.load(path)?));
        *model = Box::into_raw(m);
        Ok(())
    })
}

/// Read the loader options: a JSON object, or null for the defaults.
unsafe fn read_options(options: *const c_char) -> Result<OnnxOptionsSpec> {
    if options.is_null() {
        return Ok(OnnxOptions::new().into());
    }
    Ok(unsafe { CStr::from_ptr(options) }.to_str()?.into())
}

/// Parse and load an ONNX model as a tract InferenceModel, with loader options.
///
/// `options` is a null-terminated utf-8 JSON object, or null for the defaults.
/// See `OnnxOptions` in the Rust API for the fields. An unknown field is an error.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…