ClikaRT::ops::nll_loss
function
nll_loss()
Tensor nll_loss(
Tensor input,
Tensor target,
OptionalTensor weight = {},
std::optional<int64_t> ignore_index = std::nullopt,
Reduction reduction = Reduction::Mean
)
Negative-log-likelihood loss over LOG-probabilities; class dim LAST.
input is expected to already be log-probabilities (pair with log_softmax; cross_entropy is the fused form).
Parameters
input: log-probabilities[.., C].target: class indices[..](integer dtype).weight: optional per-class weight[C].ignore_index: optional target value whose positions contribute no loss; absent = no masking.reduction:None/Mean/Sum; defaultMean.
Returns: the loss (0-D under Mean/Sum; [..] under None).
Throws
ClikaRT::Error: (INVALID_ARGUMENT) whentarget's shape is notinput's minus the class axis, or a target index is out of range.
Declared in ClikaRT/compute/ops.h, line 3018