Losses

Losses#

Sparsity objectives minimized during training.

Loss functions for sparse basis training.

Mirror of upstream src/loss.jl. Single-image path only; batched loss dispatch is deferred to a later phase.

Contents

L1Norm

L1 norm loss: minimizes sum(|T(x)|) to encourage sparsity.

MSELoss

MSE loss with top-k truncation: ||x - T^{-1}(truncate(T(x), k))||^2.

AbstractLoss

Marker protocol for loss types.

loss_function

Compute scalar loss for a single image under the given circuit.

topk_truncate

Keep the k coefficients with largest absolute value; zero the rest.