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<Int32>(dimensionSize);
  final externalTypedData = dimensions.asTypedList(dimensionSize);
  externalTypedData.setRange(0, dimensionSize, shape);
  final status = tfLiteInterpreterResizeInputTensor(
      _interpreter, tensorIndex, dimensions, dimensionSize);
  calloc.free(dimensions);
  checkState(status == TfLiteStatus.ok);
  _inputTensors = null;
  _outputTensors = null;
  _allocated = false;
}