getOutputTensor method

Tensor getOutputTensor(
  1. int index
)

Gets the output Tensor for the provided output index.

Implementation

Tensor getOutputTensor(int index) {
  _outputTensorsCount ??=
      tfliteBinding.TfLiteInterpreterGetOutputTensorCount(_interpreter);
  if (index < 0 || index >= _outputTensorsCount!) {
    throw ArgumentError('Invalid output Tensor index: $index');
  }
  if (_outputTensors != null) {
    return _outputTensors![index];
  }
  final outputTensor = Tensor(
      tfliteBinding.TfLiteInterpreterGetOutputTensor(_interpreter, index));
  return outputTensor;
}