allocateTensors method

void allocateTensors()

Allocates memory for all tensors in this signature.

Must be called after Interpreter.getSignatureRunner and after any resizeInputTensor calls, before the first invoke.

Implementation

void allocateTensors() {
  checkState(!_closed, message: 'SignatureRunner is already closed.');
  checkState(
    tfliteBinding.TfLiteSignatureRunnerAllocateTensors(_runner) ==
        TfLiteStatus.kTfLiteOk,
  );
  _allocated = true;
  // Allocation can relocate tensor structs (e.g. first-time delegate
  // application grows the tensors arena), so cached handles may dangle.
  _invalidateTensorCaches();
}