oa::ml::loss::cross_entropy
Compute mean cross-entropy over rank-two FP32 logits and U32 or I32 class targets. logits has shape [N, C], targets has shape [N], and the returned matrix is an FP32 scalar. I32 targets must be non-negative; any negative or out-of-range target produces NaN without an out-of-bounds access. Errors Returns an error when ranks, shapes, dtypes, ownership, allocation, or runtime recording are invalid.
Function Documentation
Compute mean cross-entropy over rank-two FP32 logits and U32 or I32 class targets. logits has shape [N, C], targets has shape [N], and the returned matrix is an FP32 scalar. I32 targets must be non-negative; any negative or out-of-range target produces NaN without an out-of-bounds access. Errors Returns an error when ranks, shapes, dtypes, ownership, allocation, or runtime recording are invalid.