eureka7mt commented on a change in pull request #13612: add pos_weight for
SigmoidBinaryCrossEntropyLoss
URL: https://github.com/apache/incubator-mxnet/pull/13612#discussion_r243146196
##########
File path: python/mxnet/gluon/loss.py
##########
@@ -227,13 +238,20 @@ def __init__(self, from_sigmoid=False, weight=None,
batch_axis=0, **kwargs):
super(SigmoidBinaryCrossEntropyLoss, self).__init__(weight,
batch_axis, **kwargs)
self._from_sigmoid = from_sigmoid
- def hybrid_forward(self, F, pred, label, sample_weight=None):
+ def hybrid_forward(self, F, pred, label, sample_weight=None,
pos_weight=None):
label = _reshape_like(F, label, pred)
if not self._from_sigmoid:
# We use the stable formula: max(x, 0) - x * z + log(1 +
exp(-abs(x)))
- loss = F.relu(pred) - pred * label + F.Activation(-F.abs(pred),
act_type='softrelu')
+ if pos_weight is None:
Review comment:
Well.Set pos_weight=1 is OK.I just want to write it In this format like
'sample_weight=None'.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services