Livt packages
Livt.ML
Version 1.6.1
Fixed-size quantized inference, tensor storage, attention, and transformer building blocks for Livt.
Published files (132)
tests/norm/RMSNormTest.lvt
namespace Livt.ML.Tests.Norm
using Livt.ML.Norm
/**
* Exercises RMSNorm with a shared fixture instance. Each scenario establishes the inputs
* and state it needs.
*/
@Test
component RMSNormTest
{
// Shared fixture instances, signals, and observation state.
rms: RMSNorm
/**
* Creates the shared fixture instances (RMSNorm). Tests initialize the state required by
* their scenario.
*/
new()
{
rms = new RMSNorm()
}
/**
* Checks that Compute s zero vector.
*/
@Test
fn ComputesZeroVector()
{
var input: int[8]
rms.Compute(input)
assert rms.GetOutput(0) == 0
assert rms.GetOutput(7) == 0
}
/**
* Checks that Compute s uniform vectors.
*/
@Test
fn ComputesUniformVectors()
{
var input: int[8] = [4, 4, 4, 4, 4, 4, 4, 4]
rms.Compute(input)
assert rms.GetOutput(0) == 1
assert rms.GetOutput(7) == 1
}
/**
* Checks that Compute s varied vector.
*/
@Test
fn ComputesVariedVector()
{
var input: int[8] = [6, 8, 0, 0, 0, 0, 0, 0]
rms.Compute(input)
assert rms.GetOutput(0) == 2
assert rms.GetOutput(1) == 2
assert rms.GetOutput(8) == 0
}
}