Map sorting in python

I’ve trained a CNN model and for a neuron x in layer y I have a a tensor like


now I want to sort based on this tensor and find the 5 neuron with most values and I want the layer and id be mapped with this tensor once I sort it.
How should I do this?