-
-
Save aribornstein/e690db9394b756c1d981ca3b654ae746 to your computer and use it in GitHub Desktop.
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
class Probabilities(ClassificationSerializer): | |
""" | |
A :class:`.Serializer` which applies a softmax to the model outputs | |
(assumed to be logits) and converts to a list. | |
""" | |
def serialize(self, sample: Any) -> Any: | |
return torch.softmax(sample, -1).tolist() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment