Skip to content
fn

bce_with_logits_op

→TensorImplPtr
int bce_with_logits_op(const int & input, const int & target, const int & weight, const int & pos_weight, int reduction)

Public BCE-with-logits entry point.

Parameters

inputTensorImplPtr
Raw logits (any real value).
targetTensorImplPtr
Binary targets in {0,1}\{0, 1\} of the same shape.
weightTensorImplPtr
Per-element weighting tensor.
pos_weightTensorImplPtr
Positive-class re-weighting; pass a ones tensor when unused.
reductionint
0 (None), 1 (Mean), or 2 (Sum).

Returns

TensorImplPtr

Reduced or per-element loss tensor.