CompiledModelConfig class
Value configuration for policy-based CompiledModel construction.
Use this with CompiledModel.fromFileWithConfig,
CompiledModel.fromBufferWithConfig, or
CompiledModel.fromBufferWithConfigAsync. The existing low-level
constructors that accept an exact Set<Accelerator> remain available for
advanced combinations and retain their original semantics.
Constructors
- CompiledModelConfig({CompiledModelPolicy policy = CompiledModelPolicy.auto, Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed})
-
Creates a policy-based CompiledModel configuration.
const
- CompiledModelConfig.auto({Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed})
-
Package-recommended accelerator selection.
const
- CompiledModelConfig.cpu({Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed})
-
CPU-only compilation.
const
- CompiledModelConfig.gpu({Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed})
-
Strict GPU compilation.
const
- CompiledModelConfig.gpuWithCpuFallback({Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed})
-
GPU-preferred compilation with a complete CPU retry.
const
- CompiledModelConfig.npu({Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed})
-
Strict NPU compilation.
const
- CompiledModelConfig.npuWithCpuFallback({Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed})
-
NPU-preferred compilation with a complete CPU retry.
const
Properties
- allowsCpuFallback → bool
-
Whether a failed preferred compilation is retried as CPU-only.
no setter
-
fallbackAccelerators
→ Set<
Accelerator> ? -
Accelerator set used for a complete retry after primary construction
fails, or null when the policy has no complete fallback.
no setter
- hashCode → int
-
The hash code for this object.
no setteroverride
- policy → CompiledModelPolicy
-
Ordered accelerator selection and fallback policy.
final
- precision → Precision
-
GPU precision.
final
-
primaryAccelerators
→ Set<
Accelerator> -
Exact accelerator set used for the policy's first construction attempt.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tensorBufferMode → TensorBufferMode
-
Tensor buffer allocation mode.
final
Methods
-
copyWith(
{CompiledModelPolicy? policy, Precision? precision, TensorBufferMode? tensorBufferMode}) → CompiledModelConfig - Returns a copy with the supplied fields replaced.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override