getInputTensor method

Tensor getInputTensor(
  1. int index
)

Gets the input Tensor for the provided input index.

Implementation

Tensor getInputTensor(int index) {
  _inputTensorsCount ??=
      tfliteBinding.TfLiteInterpreterGetInputTensorCount(_interpreter);
  if (index < 0 || index >= _inputTensorsCount!) {
    throw ArgumentError('Invalid input Tensor index: $index');
  }
  if (_inputTensors != null) {
    return _inputTensors![index];
  }

  final inputTensor = Tensor(
      tfliteBinding.TfLiteInterpreterGetInputTensor(_interpreter, index));
  return inputTensor;
}