Replies: 1 comment 2 replies
-
|
Good question! In short:
Why? This is because softmax is a "monotonic function" - https://en.wikipedia.org/wiki/Monotonic_function For example, it doesn't change the order of the inputs that go into it, only their values (from one form to another form, more specifically to be in range of 0 to 1 and all adding to 1). ExamplesThe following two lines of code will output the same values: import torch
torch.manual_seed(42)
tensor_A = torch.randn(1, 10)
softmax = torch.argmax(torch.softmax(tensor_A, dim=1), dim=1)
no_softmax = torch.argmax(tensor_A, dim=1)
print(softmax == no_softmax)Output: Why transform logits to prediction probabilities then?I find these helpful to understand more than raw logits but it's not 100% necessary. Try playing around with the input and output values with and without softmax. And to dig deeper, see how the softmax function is defined, replicating it without using in-built functions would be a great exercise: https://en.wikipedia.org/wiki/Softmax_function |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Original question:
Beta Was this translation helpful? Give feedback.
All reactions