Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, **kwargs):
LossNM.__init__(self, **kwargs)
loss_params = {
"label_smoothing": self.local_parameters.get("label_smoothing", 0),
"predict_last_k": self.local_parameters.get("predict_last_k", 0)
}
self._loss_fn = SmoothedCrossEntropyLoss(**loss_params)
self._pad_id = self.local_parameters['pad_id']
def __init__(self, **kwargs):
LossNM.__init__(self, **kwargs)
self._criterion = nn.MSELoss()
def __init__(self, label_smoothing=0.0, **kwargs):
LossNM.__init__(self, **kwargs)
self._criterion = SmoothedCrossEntropyLoss(label_smoothing)
def __init__(self, *, num_classes, **kwargs):
LossNM.__init__(self, **kwargs)
# self._blank = self.local_parameters.get('blank', 0)
self._blank = num_classes
self._criterion = nn.CTCLoss(blank=self._blank,
reduction='none')
def __init__(self, **kwargs):
LossNM.__init__(self, **kwargs)
loss_params = {
"label_smoothing": self.local_parameters.get("label_smoothing", 0),
"predict_last_k": self.local_parameters.get("predict_last_k", 0)
}
self._loss_fn = SmoothedCrossEntropyLoss(**loss_params)
self._pad_id = self.local_parameters['pad_id']
def __init__(self, num_classes, **kwargs):
LossNM.__init__(self, **kwargs)
self._criterion = nn.CrossEntropyLoss()
self.num_classes = num_classes
def __init__(self, *, num_inputs, **kwargs):
kwargs["create_port_args"] = {"num_losses": num_inputs}
LossNM.__init__(self, **kwargs)
def __init__(self, num_slots, **kwargs):
LossNM.__init__(self, **kwargs)
self.num_slots = num_slots
self._criterion = nn.CrossEntropyLoss()
def __init__(self, **kwargs):
# Neural Module API specific
LossNM.__init__(self, **kwargs)
# End of Neural Module API specific
self._criterion = torch.nn.NLLLoss()