Skip to main content

lower_to_stablehlo

Function lower_to_stablehlo 

Source
pub fn lower_to_stablehlo(program: &GraphProgram) -> Result<StableHloModule>
Expand description

Lower a static-shaped graph program to StableHLO MLIR text.

ยงExamples

use tenferro_runtime::{GraphCompiler, TracedTensor};
use tenferro_xla::lower_to_stablehlo;

let x = TracedTensor::from_vec_col_major(vec![1], vec![3.0_f64]).unwrap();
let mut compiler = GraphCompiler::new();
let program = compiler.compile(&x.neg()).unwrap();
let module = lower_to_stablehlo(&program).unwrap();
assert!(module.as_str().contains("stablehlo.negate"));