Computes binary cross-entropy loss between predictions and binary targets.
Usage
mlx_binary_cross_entropy(
predictions,
targets,
reduction = c("mean", "sum", "none")
)Examples
preds <- mlx_matrix(c(0.9, 0.2, 0.8), 3, 1)
targets <- mlx_matrix(c(1, 0, 1), 3, 1)
mlx_binary_cross_entropy(preds, targets)
#> mlx array []
#> dtype: float32
#> device: gpu
#> values:
#> [1] 0.1838825