Performance, Pytorch, Deep Learning, Artificial Intelligence, Tensorboard.
torch.profiler.record_function('mask'): masked_target = target[mask] masked_pred = permuted_pred[mask.unsqueeze(-1).expand(-1, -1, -1, self.num_classes)] masked_pred = masked_pred.reshape(-1, self.num_classes) # calculate the cross-entropy loss with torch.profiler.record_function('calc loss'): loss