QuantumLoss<T>

Models & Types ยท AiDotNet.LossFunctions

Represents a quantum-specific loss function for quantum neural networks.

Inheritance: LossFunctionBase<T> โ†’ QuantumLoss<T>

Example

using AiDotNet.LossFunctions;
using AiDotNet.Tensors.LinearAlgebra;

var loss = new QuantumLoss<float>();
var predicted = new Vector<float>(new[] { 0.9f, 0.2f, 0.7f });
var actual = new Vector<float>(new[] { 1.0f, 0.0f, 1.0f });

float value = loss.CalculateLoss(predicted, actual);
Console.WriteLine($"QuantumLoss = {value:F4}");

Constructors

Constructor Summary
QuantumLoss()

Methods

Method Summary
T CalculateLoss(Vector<T> predicted, Vector<T> expected) Calculates the quantum loss between predicted and expected quantum states.
Tensor<T> ComputeTapeLoss(Tensor<T> predicted, Tensor<T> target)