There was an error while loading. Please reload this page.
1 parent 7cd6cc1 commit ee10e74Copy full SHA for ee10e74
torch/nn/modules/loss.py
@@ -361,8 +361,8 @@ class MultiLabelSoftMarginLoss(_WeightedLoss):
361
loss based on max-entropy, between input `x` (a 2D mini-batch `Tensor`) and
362
target `y` (a binary 2D `Tensor`). For each sample in the minibatch::
363
364
- loss(x, y) = - sum_i (y[i] log( exp(x[i]) / (1 + exp(x[i])))
365
- + (1-y[i]) log(1/(1+exp(x[i])))) / x:nElement()
+ loss(x, y) = - sum_i (y[i] * log( 1 / (1 + exp(-x[i])) )
+ + ( (1-y[i]) * log(exp(-x[i]) / (1 + exp(-x[i])) ) )
366
367
where `i == 0` to `x.nElement()-1`, `y[i] in {0,1}`.
368
`y` and `x` must have the same size.
0 commit comments