slice method
Implementation
Tensor slice(int startRow, int rowCount) {
// 1. Safety check
if (startRow < 0 || (startRow + rowCount) > shape[0]) {
throw RangeError("Slice indices out of bounds for shape $shape");
}
// 2. Call the engine (same one used by getRow)
// startRow: where to begin, rowCount: how many rows to take
final handle = engine.sliceTensor(_handle, startRow, rowCount);
// 3. Return as a new Tensor (usually a unique handle in C++)
return Tensor._raw(handle, [rowCount, shape[1]], isView: false);
}