Here is an example in PWC-Net. https://youtu.be/LBJ20kxr1a0?t=775 32
The main idea is to calculate the correlation as dot product between two features. Larger result indicates more similar.
Meanwhile, the correlation could be between each feature in map1 and all features in map2; and each feature in map1 and its corresponding neighbor in map2.