fix loss info and typo (Closes GH-22).

This commit is contained in:
darkliang
2021-12-09 15:11:06 +08:00
parent 0d869161c2
commit 49cbc44069
16 changed files with 37 additions and 36 deletions
+12 -7
View File
@@ -29,14 +29,19 @@ class BaseLoss(nn.Module):
"""
Base class for all losses.
Your loss should also subclass this class.
Attribute:
loss_term_weights: the weight of the loss.
info: the loss info.
Your loss should also subclass this class.
"""
loss_term_weights = 1.0
info = Odict()
def __init__(self, loss_term_weight=1.0):
"""
Initialize the base class.
Args:
loss_term_weight: the weight of the loss term.
"""
super(BaseLoss, self).__init__()
self.loss_term_weight = loss_term_weight
self.info = Odict()
def forward(self, logits, labels):
"""