I’m not sure I understand the use case completely, so please add more information in case I’m missing something.
Wouldn’t indexing the tensor(s) based on a mask to select the lagest elements, and zeroing out the others work or are you processing the entire parameter set somehow first?