ClikaRT::ops::binary_cross_entropy
function
binary_cross_entropy()
Tensor binary_cross_entropy(
Tensor input,
Tensor target,
OptionalTensor weight = {},
Reduction reduction = Reduction::Mean
)
Binary cross-entropy on element-wise PROBABILITIES.
input must already be probabilities in [0, 1] (apply sigmoid first, or use binary_cross_entropy_with_logits for the fused, numerically safer form). weight re-weights each element's loss.
Parameters
input: probabilities in[0, 1].target: targets in[0, 1]; same shape asinput.weight: optional per-element weight; broadcastable toinput.reduction:None/Mean/Sum; defaultMean.
Returns: the loss (0-D under Mean/Sum).
Throws
ClikaRT::Error: (INVALID_ARGUMENT) on a shape mismatch.
Declared in ClikaRT/compute/ops.h, line 2903