raycv/engine/util/container.py
2020-10-11 23:09:04 +08:00

10 lines
262 B
Python

class LossContainer:
def __init__(self, weight, loss):
self.weight = weight
self.loss = loss
def __call__(self, *args, **kwargs):
if self.weight > 0:
return self.weight * self.loss(*args, **kwargs)
return 0.0