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

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

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

# binaryCrossEntropyWithLogits

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

`binaryCrossEntropyWithLogits(input: Tensor, target: Tensor, weight: Tensor? = null, reduction: Reduction = Reduction.MEAN, posWeight: Tensor? = null)`: the `binary_cross_entropy_with_logits` operator. Binary cross-entropy on RAW LOGITS (sigmoid fused, numerically stable). Computes `binary_cross_entropy(sigmoid(input), target)` in one pass without materializing the probabilities. `pos_weight` scales the positive-class term per element (class-imbalance correction).