Skip to main content

aot_compile

Function aot_compile 

Source
pub fn aot_compile<'a, M, L>(
    model: &M,
    input_dtype: DtypeRepr,
    input_shape: Shape,
    lowering: &L,
    mode: LoweringMode,
    args: &AotArgs,
) -> Result<()>
where M: Layer<SymTensor>, L: Lowering<'a>,
Expand description

Trace model with a symbolic sample input of input_dtype/input_shape, then ahead-of-time compile every kernel the traced graph references for the backend/config selected by args.

The compiled artifacts are written to args.resolve_cache_dir() as a side effect; this returns () rather than a backend-specific model type so that callers (and --device dispatch here) don’t need to unify return types across backends. Callers that need the compiled model in-process (e.g. to immediately .load() it onto a live device) should call the backend’s own compile entry point directly instead.