Missing Interpreter set_tensor method
ShannonHall opened this issue · comments
I am trying to convert a python implementation to be used in Flutter.
This is a function definition I am unable to find interpreter.set_tensor
it is not part the flutter-tflite Interpreter API
set_tensor is defined here https://www.tensorflow.org/api_docs/python/tf/lite/Interpreter#set_tensor
def tflite_predict(tflite_interpreter, input_index, output_index, x):
tflite_interpreter.set_tensor(input_index, x)
tflite_interpreter.invoke()
return tflite_interpreter.get_tensor(output_index)[None, ]
Here is what I have
Tensor tfliteMissPredict(
Interpreter interpreter,
int inputIndex,
int outputIndex,
dynamic data,
) {
// interpreter.setTensor(data) <--- Not part of the API
interpreter.invoke();
return interpreter.getOutputTensor(outputIndex);
}
Is there another approach for this case?
I don't think you need to do that step. After _interpreter.allocateTensors()
; interpreter.getOutputTensor
should work fine.
I don't think you need to do that step. After
_interpreter.allocateTensors()
;interpreter.getOutputTensor
should work fine.
There is data passed into tfliteMissPredict
and the function is called in a stream many times very quickly with the input index being updated with each call.
I have updated the dart code to reflect the data being passed in.
Any luck on solving this or finding another approach? Currently facing the same issue.