Created
March 5, 2020 17:28
-
-
Save idleuncle/d383866efd50461736e45850a2425c25 to your computer and use it in GitHub Desktop.
softmax
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 softmax(x): | |
e_x = np.exp(x - np.max(x, axis=1).reshape(-1, 1)) | |
return e_x / e_x.sum(axis=1).reshape(-1, 1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment