Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
bytecodealliance
GitHub Repository: bytecodealliance/wasmtime
Path: blob/main/crates/wasi-nn/tests/check/winml.rs
3139 views
1
use wasmtime::{Result, format_err};
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(format_err!(
14
"WinML learning device is not available: {:?}",
15
e
16
)),
17
}
18
}
19
20