Interpreter

herkese açık final dersi Çevirmen

TensorFlow Lite ile model çıkarımı yapmak için sürücü sınıfı.

Not: "Deneysel" çalışmalardan hiçbirine erişmeniz gerekmiyorsa Aşağıdaki API özelliklerini kullanın; Yorumlayıcı'yı doğrudan kullanmak yerine ConsulterApi ve ConsulterFactory.

Interpreter, önceden eğitilmiş bir TensorFlow Lite modelini içerir. Bu modelde gibi işlemler model çıkarımı için yürütülür.

Örneğin, bir model yalnızca bir giriş alır ve yalnızca bir çıkış döndürürse:

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

Bir model birden fazla giriş veya çıkış alıyorsa:

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 (Interpreter interpreter = new Interpreter(file_of_a_tensorflowlite_model)) {
   interpreter.runForMultipleInputsOutputs(inputs, map_of_indices_to_outputs);
 }
 

Bir model dize tensörleri alır veya üretirse:

String[] input = {"foo", "bar"};  // Input tensor shape is [2].
 String[][] output = new