Function engram::loss::bce

source ·
pub fn bce(predictions: &Tensor, targets: &Tensor) -> Tensor
Expand description

Returns the binary cross entropy between the predictions and the targets.

§Examples

let predictions = tensor![[0.9, 0.1, 0.2], [0.1, 0.9, 0.8]];
let targets = tensor![[1.0, 0.0, 0.0], [0.0, 1.0, 1.0]];
let loss = bce(&predictions, &targets);
                         [0.10536051565782628, 0.10536051565782628, 0.2231435513142097]]);