make available_providers function
This commit is contained in:
parent
4f6be5efb9
commit
7a6101bee7
@ -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);
|
||||||
|
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user