Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/wasi-nn/tests/check/winml.rs
1693 views
1
use anyhow::{Result, anyhow};
2
use windows::AI::MachineLearning::{LearningModelDevice, LearningModelDeviceKind};
3
4
/// Return `Ok` if we can use WinML.
5
pub fn is_available() -> Result<()> {
6
match std::panic::catch_unwind(|| {
7
println!(
8
"> WinML learning device is available: {:?}",
9
LearningModelDevice::Create(LearningModelDeviceKind::Default)
10
)
11
}) {
12
Ok(_) => Ok(()),
13
Err(e) => Err(anyhow!("WinML learning device is not available: {:?}", e)),
14
}
15
}
16
17