Interpreter class

TensorFlowLite interpreter for running inference on a model.

Constructors

Interpreter.fromAddress(int address, {bool allocated = false, bool deleted = false})
Creates interpreter from an address.
factory
Interpreter.fromBuffer(Uint8List buffer, {InterpreterOptions? options})
Creates interpreter from a buffer
factory
Interpreter.fromFile(File modelFile, {InterpreterOptions? options})
Creates Interpreter from a model file
factory

Properties

address int
Returns the address to the interpreter
no setter
hashCode int
The hash code for this object.
no setterinherited
isAllocated bool
no setter
isDeleted bool
no setter
lastNativeInferenceDurationMicroSeconds int
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

allocateTensors() → void
Updates allocations for all tensors.
close() → void
Destroys the interpreter instance.
getInputIndex(String opName) int
Gets index of an input given the op name of the input.
getInputTensor(int index) Tensor
Gets the input Tensor for the provided input index.
getInputTensors() List<Tensor>
Gets all input tensors associated with the model.
getOutputIndex(String opName) int
Gets index of an output given the op name of the output.
getOutputTensor(int index) Tensor
Gets the output Tensor for the provided output index.
getOutputTensors() List<Tensor>
Gets all output tensors associated with the model.
invoke() → void
Runs inference for the loaded graph.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
resetVariableTensors() → void
resizeInputTensor(int tensorIndex, List<int> shape) → void
Resize input tensor for the given tensor index. allocateTensors must be called again afterward.
run(Object input, Object output) → void
Run for single input and output
runForMultipleInputs(List<Object> inputs, Map<int, Object> outputs) → void
Run for multiple inputs and outputs
runInference(List<Object> inputs) → void
Just run inference
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromAsset(String assetName, {InterpreterOptions? options}) Future<Interpreter>
Creates interpreter from a assetName