I have a tensor of probability distributions t of size (n, c, h, w), such that t.sum(dim=1) == 1.
What’s the best way to retrieve low entropy predictions, and to “peak” them such that they become one-hot, preserving differentiability? Retrieving may be performed also using a threshold on the probabilities (e.g. p such that exists a p[i] > 0.9).
For example, if I have [0.05, 0.9, 0.05] the peaked output would be [0., 1., 0.].
How can I efficiently perform the peaking?