//! Minimal known-answer test for layers.linear. const std = @import("std"); const crucible = @import("crucible"); pub fn main(init: std.process.Init) !void { const alloc = init.gpa; // in_n = 8, out_n = 1, bias 0. w = 1..8, x = 1..8 -> expect 204. var w: [8]f32 = .{ 1, 2, 3, 4, 5, 6, 7, 8 }; var x: [8]f32 = .{ 1, 2, 3, 4, 5, 6, 7, 8 }; var b: [1]f32 = .{0}; var out: [1]f32 = undefined; crucible.layers.linear(&x, &w, &b, &out); std.debug.print("case1 (expect 204): {e}\n", .{out[0]}); // bias 100 b[0] = 100; crucible.layers.linear(&x, &w, &b, &out); std.debug.print("case2 (expect 304): {e}\n", .{out[0]}); // in_n = 4 (the pose_fc case!) w=1..4 x=1..4 -> 30 var w4: [4]f32 = .{ 1, 2, 3, 4 }; var x4: [4]f32 = .{ 1, 2, 3, 4 }; var b1: [1]f32 = .{0}; var out1: [1]f32 = undefined; crucible.layers.linear(&x4, &w4, &b1, &out1); std.debug.print("case3 (expect 30): {e}\n", .{out1[0]}); _ = alloc; }