evaluateLoss

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>(source)

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