Livt packages

Livt.ML

Version 1.6.1

Fixed-size quantized inference, tensor storage, attention, and transformer building blocks for Livt.

Published files (132)

tests/classifier/ArgMax3Test.lvt

namespace Livt.ML.Tests.Classifier

using Livt.ML.Classifier

/**
 * Exercises ArgMax3 with a shared fixture instance. Each scenario establishes the inputs
 * and state it needs.
 */
@Test
component ArgMax3Test
{
	// Shared fixture instances, signals, and observation state.
	argmax: ArgMax3

	/**
	 * Creates the shared fixture instances (ArgMax3). Tests initialize the state required by
	 * their scenario.
	 */
	new()
	{
		argmax = new ArgMax3()
	}

	/**
	 * Checks that Select s class0.
	 */
	@Test
	fn SelectsClass0()
	{
		argmax.Compute(10, 0, 0)

		assert argmax.GetClass() == ArgMax3.CLASS_0
	}

	/**
	 * Checks that Select s class1.
	 */
	@Test
	fn SelectsClass1()
	{
		argmax.Compute(0, 10, 3)

		assert argmax.GetClass() == ArgMax3.CLASS_1
	}

	/**
	 * Checks that Select s class2.
	 */
	@Test
	fn SelectsClass2()
	{
		argmax.Compute(0, 3, 10)

		assert argmax.GetClass() == ArgMax3.CLASS_2
	}

	/**
	 * Checks the ties resolve to lowest class case.
	 */
	@Test
	fn TiesResolveToLowestClass()
	{
		argmax.Compute(5, 5, 5)

		assert argmax.GetClass() == ArgMax3.CLASS_0
	}
}