From 14bcf90db9e69c0a518c0bb5ccf7ad89c7467ef3 Mon Sep 17 00:00:00 2001 From: Clemens Akens Date: Thu, 12 Oct 2023 14:09:32 +0200 Subject: [PATCH] Minor refactoring --- src/vector.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/vector.zig b/src/vector.zig index 570e016..9c2bda3 100644 --- a/src/vector.zig +++ b/src/vector.zig @@ -56,11 +56,11 @@ pub fn dot(input_a: []const f32, input_b: []const f32) f32 { } // Pre-normalization using RMSNorm: https://arxiv.org/abs/1910.07467 -pub fn rmsnorm(input: []const f32, weight: []const f32, output: []f32) void { +pub fn rmsnorm(input: []const f32, weights: []const f32, output: []f32) void { @setFloatMode(.Optimized); std.debug.assert(output.len == input.len); - std.debug.assert(output.len == weight.len); + std.debug.assert(output.len == weights.len); var rms_scaling_factor: f32 = 0; @@ -73,7 +73,7 @@ pub fn rmsnorm(input: []const f32, weight: []const f32, output: []f32) void { rms_scaling_factor = 1 / std.math.sqrt(rms_scaling_factor); for (output, 0..) |*element, index| { - element.* = weight[index] * rms_scaling_factor * input[index]; + element.* = weights[index] * rms_scaling_factor * input[index]; } }