Livt packages
Livt.ML
Version 1.6.1
Fixed-size quantized inference, tensor storage, attention, and transformer building blocks for Livt.
Published files (132)
src/classifier/ArgMax10.lvt
namespace Livt.ML.Classifier
/**
* Selects the first maximum among ten classifier outputs.
*/
component ArgMax10
{
// Latest computed result, retained for the caller.
classId: int
/**
* Stores the first index containing the largest value.
*/
public fn Compute(values: int[10])
{
var bestIndex = 0
var bestValue = values[0]
for (var index = 1; index < 10; index++) {
if (values[index] > bestValue) {
bestValue = values[index]
bestIndex = index
}
}
classId = bestIndex
}
/**
* Returns the stored class in the range zero through nine.
*/
public fn GetClass() int
{
return classId
}
}