use rlx_runtime::CompileOptions;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
pub enum OnnxCompileLevel {
Level0,
Level1,
#[default]
Level2,
Level3,
}
impl OnnxCompileLevel {
pub fn from_u8(n: u8) -> Self {
match n {
0 => Self::Level0,
1 => Self::Level1,
2 => Self::Level2,
_ => Self::Level3,
}
}
pub fn to_compile_options(self) -> CompileOptions {
match self {
Self::Level0 => CompileOptions::new()
.with_dce(false)
.with_constant_folding(false),
Self::Level1 => CompileOptions::new().with_constant_folding(false),
Self::Level2 | Self::Level3 => CompileOptions::default(),
}
}
}