public class MeanSquaredError<T extends AbstractFloat = Float> implements RegressionLoss<T>
Mean squared residual over all samples and output coordinates. The derivative is 2 * (prediction - target) / elementCount. FP64 loss accumulation does not widen the physical tensors. CPU and GPU paths fuse residual calculation, loss reduction and gradient production, without a residual tensor, squared tensor or transfer of whole GPU inputs to the CPU.
result = MeanSquaredError<Float>().compute(predictions, targets)
| Modifier and Type | Member | Description |
|---|---|---|
| public | MeanSquaredError | Creates an all-coordinate mean squared error objective. |
| Modifier and Type | Member | Description |
|---|---|---|
| public override | computecompute(outputs as NDArray<T>, targets as NDArray<T>, gradientScale as Double = 1.0) as LossResult<T> |
Computes MSE and a same-shaped, independent output derivative. |