CompiledModel class
LiteRT Next CompiledModel inference API.
Properties
-
accelerators
→ Set<
Accelerator> -
Accelerators this model was compiled with.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
-
inputByteSizes
→ List<
int> -
Byte size of each input tensor buffer.
no setter
- inputCount → int
-
Number of model input tensors.
no setter
-
outputByteSizes
→ List<
int> -
Byte size of each output tensor buffer.
no setter
- outputCount → int
-
Number of model output tensors.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- tensorBufferMode → TensorBufferMode
-
Tensor buffer allocation mode used by this model.
no setter
Methods
-
close(
) → void - Releases native CompiledModel resources.
-
dispatch(
) → void - Runs inference using inputs previously written with writeInput.
-
dispatchAsync(
) → Future< void> - Runs inference asynchronously using inputs previously written with writeInput.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readOutput<
R> (int index, R read(Float32List output)) → R -
Reads output
indexdirectly from a host-memory tensor buffer. -
run(
List< Float32List> inputs) → List<Float32List> - Runs inference with Float32 input tensors and returns Float32 outputs.
-
runAsync(
List< Float32List> inputs) → Future<List< Float32List> > - Runs inference asynchronously when the selected accelerator supports it.
-
toString(
) → String -
A string representation of this object.
inherited
-
writeInput(
int index, void write(Float32List input)) → void -
Writes input
indexdirectly into a host-memory tensor buffer.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
fromBuffer(
Uint8List bytes, {Set< Accelerator> accelerators = const {Accelerator.cpu}, Precision precision = Precision.fp16, TensorBufferMode tensorBufferMode = TensorBufferMode.managed}) → CompiledModel - Creates a compiled model from model bytes.
-
fromBufferAsync(
Uint8List bytes, {Set< Accelerator> accelerators = const {Accelerator.cpu}, Precision precision = Precision.fp16, TensorBufferMode tensorBufferMode = TensorBufferMode.managed}) → Future<CompiledModel> - Creates a compiled model from model bytes without requiring synchronous compilation.
-
fromBufferWithGpuFallback(
Uint8List bytes, {bool forceCpu = false, Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed, void onFallback(Object error)?}) → CompiledModel -
Creates a compiled model from
bytes, preferring GPU with a CPU fallback. -
fromBufferWithGpuFallbackAsync(
Uint8List bytes, {bool forceCpu = false, Precision precision = Precision.fp32, TensorBufferMode tensorBufferMode = TensorBufferMode.managed, void onFallback(Object error)?}) → Future< CompiledModel> -
Creates a compiled model from
bytes, preferring GPU with a CPU fallback, without requiring synchronous compilation. -
fromFile(
String path, {Set< Accelerator> accelerators = const {Accelerator.cpu}, Precision precision = Precision.fp16, TensorBufferMode tensorBufferMode = TensorBufferMode.managed}) → CompiledModel - Creates a compiled model from a model file.