run method

void run(
  1. Object input,
  2. Object output
)

Run for single input and output

Implementation

void run(Object input, Object output) {
  final outputCount = _outputTensorsCount ??=
      tfliteBinding.TfLiteInterpreterGetOutputTensorCount(_interpreter);
  if (outputCount != 1) {
    // Preserve the map path and its missing-output failure mode.
    runForMultipleInputs([input], <int, Object>{0: output});
    return;
  }
  // Single-output fast path: same steps as runForMultipleInputs without
  // allocating and indexing the one-entry output map.
  _inputTensors = null;
  _outputTensors = null;
  runInference([input]);
  Tensor(
    tfliteBinding.TfLiteInterpreterGetOutputTensor(_interpreter, 0),
  ).copyTo(output);
}