fetchData method
Implementation
Float32List fetchData() {
final size = shape.reduce((a, b) => a * b);
final buffer = Float32List(size);
final ptr = calloc<ffi.Float>(size);
// Your C++ engine must have a tensor_to_host function
engine.tensorToHost(_handle, ptr);
for (int i = 0; i < size; i++) {
buffer[i] = ptr[i];
}
calloc.free(ptr);
return buffer;
}