Gone generic
The Tensor goes generic: pub fn Tensor(comptime T: type) type. Data is []T. The dtype field goes away because the type is the dtype. Callers write Tensor(f32).initCpu(...). One implementation, no f32 special cases to copy.
Once the type can be many things, add has to mean something. add is in-place: same shape, same strides, loop the other’s data onto self. ShapeMismatch and StrideMismatch become real errors. TypeMismatch is put on the error set, then a test tries to add mismatched tensors, then Zig gets us. add takes @This(), so Tensor(f32) cannot even see a Tensor(u32). The type-mismatch test should not have existed. It is deleted the same afternoon.
What remains is f32 plus f32, later u32 plus u32, element-wise, in place. First operation that looks like a library instead of a struct. Not GEMM. Not a network. Two tensors, same layout, add.
535210f · 2ddf14b · 077d71e · 6362ca1 · f4b27f9 · 990849a · d8c457a · 323a026