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/QLinearMatMul256x10RamTest.lvt
namespace Livt.ML.Tests.Linear
using Livt.ML.Linear
/**
* Exercises QLinearMatMul256x10Ram with a shared fixture instance. Each scenario
* establishes the inputs and state it needs.
*/
@Test
component QLinearMatMul256x10RamTest
{
// Shared fixture instances, signals, and observation state.
dense: QLinearMatMul256x10Ram
/**
* Creates the shared fixture instances (QLinearMatMul256x10Ram). Tests initialize the
* state required by their scenario.
*/
new()
{
this.dense = new QLinearMatMul256x10Ram()
}
/**
* Checks that Compute s signed weights and repeated inference.
*/
@Test
fn ComputesSignedWeightsAndRepeatedInference()
{
this.dense.Clear()
// RAM payloads are unspecified until written; initialize the whole vector.
for (var row = 0; row < 256; row++) {
this.dense.SetInput(row, 0)
}
this.dense.SetWeight(0, 0, 2)
this.dense.SetWeight(1, 0, -2)
for (var column = 0; column < 10; column++) {
this.dense.SetColumnParameters(column, 1, 1, 0, 0, 112)
}
this.dense.SetColumnParameters(0, 1, 1, 1, 0, 112)
this.dense.SetColumnParameters(1, 1, 1, 0, -1, 112)
this.dense.SetInput(0, 3)
this.dense.Compute()
assert this.dense.GetAccumulator(0) == 4
assert this.dense.GetOutput(0) == 116
assert this.dense.GetAccumulator(1) == -3
assert this.dense.GetOutput(1) == 109
this.dense.SetInput(0, 4)
this.dense.Compute()
assert this.dense.GetAccumulator(0) == 6
assert this.dense.GetOutput(0) == 118
assert this.dense.GetAccumulator(1) == -4
assert this.dense.GetOutput(1) == 108
}
}