Hi CBGxd!



 CBGxd:

I’m trying to find the top 3 maximize results from each one-hot vector, and let others be 0 (which means we want the dimension not to change).


I’m not at all sure what you are asking here.  A one-hot vector is a
vector that consists of all zeroes except for one one.  So it doesn’t
make sense to ask for the three largest values (or topk() in general)
in a one-hot vector.
Could you illustrate what you are asking with explicit numerical tensors?
Best.
K. Frank