getOutputTensor method

Tensor getOutputTensor(
  1. int index
)

Gets the output Tensor for the provided output index.

Implementation

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