How to get the heatMap coordinates at the local maxima

How to get the heatMap coordinates at the local maxima?
I have a heatMap, I want to get the coordinates of local maxima in a 5x5window
I think I can use ‘torch.nn.MaxPool2d’ to help more