Fix TensorAlloc copy that was copying the ptr

This commit is contained in:
adrien 2026-05-27 21:15:58 +02:00
parent 9ac3d4d699
commit 22ffd4fc64

View File

@ -60,9 +60,9 @@ pub fn Tensor(
} }
pub fn copy(self: *const Self, alloc: Allocator) !Self { pub fn copy(self: *const Self, alloc: Allocator) !Self {
var new = try splat(alloc, 0); const vec_ptr = try alloc.create(Vec);
new.data = self.data; vec_ptr.* = self.data.*;
return new; return .{ .data = vec_ptr };
} }
/// Convert N-D coords (row-major) to flat index fully comptime. /// Convert N-D coords (row-major) to flat index fully comptime.