PreferredBackend enum
Preferred hardware backend for model inference execution.
Specifies the computational backend to use for running AI models, allowing optimization based on device capabilities and performance requirements.
Example:
final config = ModelConfig(
modelPath: 'model.task',
maxTokens: 512,
preferredBackend: PreferredBackend.gpu,
);
Values
- unknown → const PreferredBackend
-
Unknown or unspecified backend.
The system will automatically select an appropriate backend.
const PreferredBackend(0) - cpu → const PreferredBackend
-
CPU-based inference.
Uses the device's CPU for model execution. This is more compatible but generally slower than GPU inference.
const PreferredBackend(1) - gpu → const PreferredBackend
-
GPU-based inference.
Uses the device's GPU for accelerated model execution. Provides better performance for supported models and devices.
const PreferredBackend(2)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → int
-
The numeric value representing this backend type.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Constants
-
values
→ const List<
PreferredBackend> - A constant List of the values in this enum, in order of their declaration.