Livt packages
Livt.ML
Version 1.6.1
Fixed-size quantized inference, tensor storage, attention, and transformer building blocks for Livt.
Published files (132)
- DotProduct.lvt
- FixedPointAccumulator.lvt
- Int8BroadcastMac64x8.lvt
- Int8BroadcastMac64x8Primitive.lvt
- Int8BroadcastMac64x8Primitive.vhd
- Int8Dot64x8.lvt
- Int8Dot64x8Primitive.lvt
- Int8Dot64x8Primitive.vhd
- Int8Linear4x8.lvt
- Int8Linear8x3.lvt
- Int8LinearAccumulator.lvt
- Int8Mac8.lvt
- Int8MatrixAccumulator32.lvt
- Int8MatrixAccumulator32Primitive.lvt
- Int8MatrixAccumulator32Primitive.vhd
- Int8MatrixAccumulator32Stream.lvt
- Linear8x8.lvt
- MatrixVectorMultiplication.lvt
- QLinearMatMul256x10.lvt
- QLinearMatMul256x10Ram.lvt
- QLinearMatMul256x10Stream.lvt
- QuantizedMatrix.lvt
- VecAdd.lvt
src/linear/VecAdd.lvt
namespace Livt.ML.Linear
/**
* Adds two fixed 8-element integer vectors and stores the result.
*/
component VecAdd
{
// Number of integer elements accepted by Compute.
public const VECTOR_SIZE: int = 8
// Latest computed result, retained for the caller.
output: int[8]
/**
* Adds each element of a and b into the stored output vector.
*/
public fn Compute(a: int[8], b: int[8])
{
for (var i = 0; i < VECTOR_SIZE; i++) {
output[i] = a[i] + b[i]
}
}
/**
* Returns one output element, or zero when index is out of range.
*/
public fn GetOutput(index: int) int
{
if (index < 0) {
return 0
}
if (index >= VECTOR_SIZE) {
return 0
}
return output[index]
}
}