getInputTensor method
Gets the input Tensor for the provided input index.
Implementation
Tensor getInputTensor(int index) {
if (_inputTensorsCount == null) {
_inputTensorsCount = tfLiteInterpreterGetInputTensorCount(_interpreter);
}
if (index < 0 || index >= _inputTensorsCount!) {
throw ArgumentError('Invalid input Tensor index: $index');
}
if (_inputTensors != null) {
return _inputTensors![index];
}
final inputTensor =
Tensor(tfLiteInterpreterGetInputTensor(_interpreter, index));
return inputTensor;
}