Skip to main content

MachineLearning.InferenceMode

Enum

Inference modes used by MLComponent.inferenceMode.

  • Available on all platforms
Platform details: Snapchat, SPECS, Camera Kit Web, Camera Kit Mobile fully supported.

Platform details

  • Snapchat — Fully supported.

  • SPECS — Fully supported.

  • Camera Kit Web — Fully supported.

  • Camera Kit Mobile — Fully supported.

Inference modes used by MLComponent.inferenceMode. Each mode describes how the neural network will be run.

Index

Example

//@input Component.MLComponent mlComponent
script.mlComponent.inferenceMode = MachineLearning.InferenceMode.CPU;

Enumeration Members

Accelerator

Accelerator: number

MLComponent will attempt to use a dedicated hardware accelerator to run the neural network. If the device doesn't support it, GPU mode will be used instead.


Auto

Auto: number

MLComponent will automatically decide how to run the neural network based on what is supported. It will start with Accelerator, then fall back to GPU, then CPU.


CPU

CPU: number

MLComponent will run the neural network on CPU. Available on all devices.


GPU

GPU: number

MLComponent will attempt to run the neural network on GPU. If the device doesn't support it, CPU mode will be used instead.


NativeCPU

NativeCPU: number

MLComponent will run the model on CPU using device native backend (like CoreML on Apple devices).


NativeCPUAndNPU

NativeCPUAndNPU: number

NativeCPUAndNPU: MLComponent will try to run the model using device Neural Processing Unit (e.g. Apple Neural Engine on Apple devices) if exists and model is supported, with fallback support for running on CPU.