LossModule

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

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).

Constructors

Link copied to clipboard
constructor(loss: Loss, reduction: Reduction = Reduction.MEAN, name: String = "loss")

Properties

Link copied to clipboard
open override val modules: List<Module<T, V>>
Link copied to clipboard
open override val name: String

Human-readable name of the node, typically the module's name.

Functions

Link copied to clipboard
open override fun forward(input: Tensor<T, V>, ctx: ExecutionContext): Tensor<T, V>
fun forward(preds: Tensor<T, V>, targets: Tensor<out DType, *>, ctx: ExecutionContext): Tensor<T, V>