Last active
July 2, 2021 04:56
-
-
Save MathiasGruber/7efd1f8e39cc0750b22de1435967f335 to your computer and use it in GitHub Desktop.
Small wrapper function for the torch cross-entropy loss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def cross_entropy(predictions: List[List[float]], targets: List[float]): | |
return nn.CrossEntropyLoss(reduction='none')(predictions, target) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment