make available_providers function

This commit is contained in:
Andrey Tkachenko 2021-01-22 14:58:21 +04:00
parent 4f6be5efb9
commit 7a6101bee7
2 changed files with 4 additions and 4 deletions

View File

@ -25,7 +25,7 @@ fn main() -> Result<()> {
let so = SessionOptions::new()?; let so = SessionOptions::new()?;
println!("Available Providers: {:?}", so.available_providers()); println!("Available Providers: {:?}", SessionOptions::available_providers());
for path in &opt.onnx { for path in &opt.onnx {
println!("model {:?}", path); println!("model {:?}", path);

View File

@ -160,8 +160,8 @@ impl SessionOptions {
let raw = call!(@unsafe @ptr CreateSessionOptions)?; let raw = call!(@unsafe @ptr CreateSessionOptions)?;
Ok(SessionOptions { raw }) Ok(SessionOptions { raw })
} }
pub fn available_providers(&self) -> Vec<String> { pub fn available_providers() -> Vec<String> {
let mut providers_array: *mut *mut i8 = std::ptr::null_mut(); let mut providers_array: *mut *mut i8 = std::ptr::null_mut();
let mut providers_len: i32 = 0; let mut providers_len: i32 = 0;
@ -178,7 +178,7 @@ impl SessionOptions {
res res
} }
pub fn add_cpu(&self, use_arena: bool) { pub fn add_cpu(&self, use_arena: bool) {
let so = self.raw; let so = self.raw;
let status = unsafe { let status = unsafe {