resizeInputTensor method

void resizeInputTensor(
  1. int tensorIndex,
  2. List<int> shape
)

Resize input tensor for the given tensor index. allocateTensors must be called again afterward.

Implementation

void resizeInputTensor(int tensorIndex, List<int> shape) {
  final dimensionSize = shape.length;
  final dimensions = calloc<Int>(dimensionSize);
  final externalTypedData =
      dimensions.cast<Int32>().asTypedList(dimensionSize);
  externalTypedData.setRange(0, dimensionSize, shape);
  final status = tfliteBinding.TfLiteInterpreterResizeInputTensor(
      _interpreter, tensorIndex, dimensions, dimensionSize);
  calloc.free(dimensions);
  checkState(status == TfLiteStatus.kTfLiteOk);
  _inputTensors = null;
  _outputTensors = null;
  _allocated = false;
}