Package-level declarations

Types

Link copied to clipboard

Binary Cross-Entropy Loss with Logits (numerically stable).

Link copied to clipboard
class BinaryCrossEntropyLoss @JvmOverloads constructor(epsilon: Float = 1.0E-7f) : Loss

Binary Cross-Entropy Loss.

Link copied to clipboard
class CategoricalCrossEntropyLoss @JvmOverloads constructor(dim: Int = -1) : Loss

Categorical Cross-Entropy Loss.

Link copied to clipboard
class CrossEntropyLoss @JvmOverloads constructor(dim: Int = -1) : Loss
Link copied to clipboard
class HingeLoss @JvmOverloads constructor(margin: Float = 1.0f) : Loss

Hinge Loss for SVM-style classification.

Link copied to clipboard
class HuberLoss @JvmOverloads constructor(delta: Float = 1.0f) : Loss

Huber Loss (Smooth L1 Loss).

Link copied to clipboard

Log-Cosh Loss.

Link copied to clipboard
interface Loss

Contract for loss functions. Implementations should validate shapes/dtypes and return either a scalar (when reduced) or per-element loss tensor.

Link copied to clipboard
class LossModule<T : DType, V>(loss: Loss, reduction: Reduction = Reduction.MEAN, val name: String = "loss") : Module<T, V>

Thin wrapper to give module-like ergonomics when wiring a loss into a pipeline. The single-argument forward is intentionally unsupported; call forward(preds, targets, ctx).

Link copied to clipboard
class MAELoss : Loss

Mean Absolute Error (L1) Loss.

Link copied to clipboard
class MSELoss : Loss
Link copied to clipboard
class PoissonLoss @JvmOverloads constructor(logInput: Boolean = true, epsilon: Float = 1.0E-8f) : Loss

Poisson Negative Log Likelihood Loss.

Link copied to clipboard
Link copied to clipboard
class SparseCategoricalCrossEntropyLoss @JvmOverloads constructor(dim: Int = -1) : Loss

Sparse Categorical Cross-Entropy Loss.

Link copied to clipboard
class SquaredHingeLoss @JvmOverloads constructor(margin: Float = 1.0f) : Loss

Squared Hinge Loss.

Functions

Link copied to clipboard
fun <T : DType, V> evaluateLoss(model: Module<T, V>, loss: Loss, inputs: Tensor<T, V>, targets: Tensor<out DType, *>, ctx: ExecutionContext, reduction: Reduction = Reduction.MEAN): Tensor<T, V>

Utility helpers to evaluate a loss given a model, inputs, and targets. Keeps loss evaluation explicit and separate from the network-building DSL.