createDynamic static method

TensorBuffer createDynamic(
  1. TfLiteType dataType
)

Creates an empty dynamic TensorBuffer with specified TfLiteType. The shape of the created TensorBuffer is {0}.

Dynamic TensorBuffers will reallocate memory when loading arrays or data buffers of different buffer sizes.

Implementation

static TensorBuffer createDynamic(TfLiteType dataType) {
  switch (dataType) {
    case TfLiteType.float32:
      return TensorBufferFloat.dynamic();
    case TfLiteType.uint8:
      return TensorBufferUint8.dynamic();
    default:
      throw ArgumentError(
          'TensorBuffer does not support data type: \" +$dataType');
  }
}