Can anybody please tell me what does this statement __constants__ = ['reduction']
mean, and how does it work ? Below is the class definition of L1Loss.
class L1Loss(_Loss):
__constants__ = ['reduction']
def __init__(self, size_average=None, reduce=None, reduction='mean'):
super(L1Loss, self).__init__(size_average, reduce, reduction)
def forward(self, input, target):
return F.l1_loss(input, target, reduction=self.reduction)