Livt packages
Livt.ML
Version 1.6.1
Fixed-size quantized inference, tensor storage, attention, and transformer building blocks for Livt.
Published files (132)
- DotProductTest.lvt
- Int8BroadcastMac64x8Test.lvt
- Int8Dot64x8Test.lvt
- Int8Linear4x8Test.lvt
- Int8Linear8x3Test.lvt
- Int8LinearAccumulatorTest.lvt
- Int8Mac8Test.lvt
- Int8MatrixAccumulator32StreamTest.lvt
- Int8MatrixAccumulator32Test.lvt
- Linear8x8Test.lvt
- MatrixVectorMultiplicationTest.lvt
- QLinearMatMul256x10RamTest.lvt
- QLinearMatMul256x10StreamTest.lvt
- QuantizedMatrixGroupingTest.lvt
- VecAddTest.lvt
tests/linear/Int8Linear8x3Test.lvt
namespace Livt.ML.Tests.Linear
using Livt.ML.Linear
/**
* Exercises Int8Linear8x3 with a shared fixture instance. Each scenario establishes the
* inputs and state it needs.
*/
@Test
component Int8Linear8x3Test
{
// Shared fixture instances, signals, and observation state.
layer: Int8Linear8x3
/**
* Creates the shared fixture instances (Int8Linear8x3). Tests initialize the state
* required by their scenario.
*/
new()
{
layer = new Int8Linear8x3()
}
/**
* Checks that Compute s signed weights and biases.
*/
@Test
fn ComputesSignedWeightsAndBiases()
{
layer.ClearParameters()
layer.SetRowValues(0, 1, -1, 2, -2, 3, -3, 4, -4)
layer.SetBias(0, 9)
var input: int[8] = [1, 2, 3, 4, 5, 6, 7, 8]
layer.Compute(input)
assert layer.GetAccumulator(0) == -1
assert layer.GetAccumulator(1) == 0
}
/**
* Checks that the component supports scalar compute without array staging.
*/
@Test
fn SupportsScalarComputeWithoutArrayStaging()
{
layer.ClearParameters()
layer.SetRowValues(2, 1, 1, 1, 1, 1, 1, 1, 1)
layer.SetBias(2, -4)
layer.ComputeValues(1, 2, 3, 4, 5, 6, 7, 8)
assert layer.GetAccumulator(2) == 32
}
/**
* Checks that the component ignores invalid rows and getters.
*/
@Test
fn IgnoresInvalidRowsAndGetters()
{
layer.ClearParameters()
layer.SetRowValues(99, 1, 1, 1, 1, 1, 1, 1, 1)
layer.SetBias(-1, 5)
layer.ComputeValues(1, 1, 1, 1, 1, 1, 1, 1)
assert layer.GetAccumulator(-1) == 0
assert layer.GetAccumulator(3) == 0
}
}