公開インターフェース
InterpreterApi
既知の間接的なサブクラス |
TensorFlow Lite モデル インタープリタのインターフェース(試験運用版のメソッドを除く)。
InterpreterApi
インスタンスは、事前トレーニング済みの TensorFlow Lite モデルをカプセル化します。
モデルの推論のために実行されます。
たとえば、モデルが 1 つの入力のみを受け取り、1 つの出力のみを返すとします。
try (InterpreterApi interpreter =
new InterpreterApi.create(file_of_a_tensorflowlite_model)) {
interpreter.run(input, 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());