Working basic eq between TensorAlloc

This commit is contained in:
adrien
2026-05-24 18:40:14 +02:00
parent 09d6ca1ff5
commit ba671ee486
5 changed files with 1026 additions and 4 deletions
+1019
View File
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -37,7 +37,7 @@ pub fn Tensor(
pub const total: comptime_int = _total;
pub const strides_arr: [shape_.len]comptime_int = _strides;
pub const ISTENSOR = true;
pub const TENSORSTATIC = true;
pub const TENSORKIND: sh.TensorKind = .static;
/// Convert N-D coords (row-major) to flat index — fully comptime.
/// Usage: Tensor.idx(.{row, col})
@@ -53,7 +53,7 @@ pub fn Tensor(
}
/// Broadcast a single value across all elements.
pub inline fn splat(v: T) Self {
pub fn splat(v: T) Self {
return .{ .data = @splat(v) };
}
+2
View File
@@ -4,6 +4,8 @@ const UnitScale = Scales.UnitScale;
const Dimensions = @import("Dimensions.zig");
const Dimension = Dimensions.Dimension;
pub const TensorKind = enum { static, alloc, gpu };
pub fn isTensor(comptime T: type) bool {
return comptime @typeInfo(T) == .@"struct" and @hasDecl(T, "ISTENSOR");
}
+1
View File
@@ -1,5 +1,6 @@
test {
_ = @import("TensorStatic.zig");
_ = @import("TensorAlloc.zig");
_ = @import("Dimensions.zig");
_ = @import("Scales.zig");
_ = @import("Base.zig");