Realm

oa::ml::loss::nll

Compute the negative log likelihood loss -mean(x[i, target_i]). input is an [N, C] score matrix (usually log-probabilities) and target an I32 [N, 1] class-index matrix. Errors Returns an error for non-rank-two, empty, or non-FP32 inputs, mismatched or out-of-range targets, or when runtime recording fails.

FnRust public API

Function Documentation

pub fn nll( input: &Matrix, target: &Matrix ) -> Result<Matrix>
Compute the negative log likelihood loss -mean(x[i, target_i]). input is an [N, C] score matrix (usually log-probabilities) and target an I32 [N, 1] class-index matrix. Errors Returns an error for non-rank-two, empty, or non-FP32 inputs, mismatched or out-of-range targets, or when runtime recording fails.