-
Story
-
Resolution: Unresolved
-
Undefined
-
None
-
None
-
None
-
- 📚 Documentation
The documentation for the `weight` parameter for the `BCEWithLogitsLoss` class is:
weight (Tensor, optional): a manual rescaling weight given to the loss
of each batch element. If given, has to be a Tensor of size `nbatch`.
This implies a vector of N
However the documentation for `F.binary_cross_entropy_with_logits` is different, it states
weight (Tensor, optional): a manual rescaling weight
if provided it's repeated to match input tensor shape
And `BCEWithLogitsLoss` simply forwards it's arguments to `F.binary_cross_entropy_with_logits`, so clearly "has to be a Tensor of size `nbatch` is incorrect".
In my tests `weights` can be 1xC, 1x1, Nx1 or NxC (which I guess is what the `F.binary_cross_entropy_with_logits` docstring is implying). But it's not totally clear and I think the `BCEWithLogitsLoss` is incorrect.
cc @svekars @brycebortree @albanD @mruberry @jbschlosser @walterddr @mikaylagawarecki @brianjo @kshitij12345