---
title: "binaryCrossEntropy"
sidebar_label: "binaryCrossEntropy"
description: "Kotlin binding reference: binaryCrossEntropy."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.runtime](../index.md)/[Ops](index.md)/[binaryCrossEntropy](binaryCrossEntropy.md)

# binaryCrossEntropy

[common]\
fun [binaryCrossEntropy](binaryCrossEntropy.md)(input: [Tensor](../Tensor/index.md), target: [Tensor](../Tensor/index.md), weight: [Tensor](../Tensor/index.md)? = null, reduction: [Reduction](../Reduction/index.md) = Reduction.MEAN): [Tensor](../Tensor/index.md)

`binaryCrossEntropy(input: Tensor, target: Tensor, weight: Tensor? = null, reduction: Reduction = Reduction.MEAN)`: the `binary_cross_entropy` operator. 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.