preferredVisionBackend property

PreferredBackend? preferredVisionBackend
final

Backend for the VISION encoder, independent of preferredBackend (the text/decoder backend). Null lets the engine choose: the native LiteRT-LM engine follows the bundle — the encoder's declared backend_constraint (the CPU when that allows it), else the NPU it is compiled for, else the CPU, because the vision encoder's STABLEHLO_COMPOSITE ops fail to prepare on the Metal/WebGPU delegates (LiteRT-LM#2461) — and reports its choice in InferenceModel.activeVisionBackend. Set one only where the section allows it (readLiteRtLmBundleInfo(path).visionEncoder in flutter_edge_ai_litertlm shows its backend_constraint); a backend it excludes is refused before the model loads. Ignored by the MediaPipe engine (whole-model backend, no per-encoder split).

Implementation

final PreferredBackend? preferredVisionBackend;