data property

Uint8List data

Underlying data buffer as bytes.

Implementation

Uint8List get data {
  final data = cast<Uint8>(tfliteBinding.TfLiteTensorData(_tensor));
  return UnmodifiableUint8ListView(
      data.asTypedList(tfliteBinding.TfLiteTensorByteSize(_tensor)));
}
void data=(Uint8List bytes)

Updates the underlying data buffer with new bytes.

The size must match the size of the tensor.

Implementation

set data(Uint8List bytes) {
  final tensorByteSize = tfliteBinding.TfLiteTensorByteSize(_tensor);
  checkArgument(tensorByteSize == bytes.length);
  final data = cast<Uint8>(tfliteBinding.TfLiteTensorData(_tensor));
  checkState(isNotNull(data), message: 'Tensor data is null.');
  final externalTypedData = data.asTypedList(tensorByteSize);
  externalTypedData.setRange(0, tensorByteSize, bytes);
}