InterpreterApi

interfaccia pubblica InterpreterApi
Sottoclassi indirette note

Interfaccia con l'interprete di modelli TensorFlow Lite, esclusi i metodi sperimentali.

Un'istanza InterpreterApi incapsula un modello TensorFlow Lite preaddestrato, in cui vengono eseguite per l'inferenza del modello.

Ad esempio, se un modello accetta un solo input e restituisce solo un output:

try (InterpreterApi interpreter =
     new InterpreterApi.create(file_of_a_tensorflowlite_model)) {
   interpreter.run(input, output);
 }
 

Se un modello accetta più input o output:

Object[] inputs = {input0, input1, ...};
 Map<Integer, Object> map_of_indices_to_outputs = new HashMap<>();
 FloatBuffer ith_output = FloatBuffer.allocateDirect(3 * 2 * 4);  // Float tensor, shape 3x2x4.
 ith_output.order(ByteOrder.nativeOrder());
 map_of_indices_to_outputs.put(i, ith_output);
 try