Performance, Pytorch, Deep Learning, Artificial Intelligence, Tensorboard.
= self.loss(masked_pred, masked_target) return loss def ignore_background(self, target: Tensor) -> Tensor: # discover all indices where target label is "background" with torch.profiler.record_function('non_zero'): inds = torch.nonzero(target == self.num_classes - 1, as_tuple=True) # reset all