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/convolution/QConv2DStreamBase.lvt

namespace Livt.ML.Convolution

/**
 * Shared numeric building block for specialized quantized Conv2D streams.
 *
 * Scheduling, tensor shape, and storage stay in the specialized component;
 * this class centralizes the ONNX uint8-by-int8 zero-point MAC contract.
 * Specialized components apply their configured requantization afterwards.
 */
class QConv2DStreamBase
{
	/**
	 * Adds one centered uint8-by-int8 product to an accumulator.
	 */
	public static fn Accumulate[](
		accumulator: int, activation: byte, weight: logic[8],
		inputZeroPoint: int, weightZeroPoint: int) int
	{
		var centeredInput = (activation as int) - inputZeroPoint
		var centeredWeight = (weight as int) - weightZeroPoint
		var product = centeredInput * centeredWeight
		return accumulator + product
	}
}