The feature correlation layer serves as a key neural network module in\nnumerous computer vision problems that involve dense correspondences between\nimage pairs. It predicts a correspondence volume by evaluating dense scalar\nproducts between feature vectors extracted from pairs of locations in two\nimages. However, this point-to-point feature comparison is insufficient when\ndisambiguating multiple similar regions in an image, severely affecting the\nperformance of the end task. We propose GOCor, a fully differentiable dense\nmatching module, acting as a direct replacement to the feature correlation\nlayer. The correspondence volume generated by our module is the result of an\ninternal optimization procedure that explicitly accounts for similar regions in\nthe scene. Moreover, our approach is capable of effectively learning spatial\nmatching priors to resolve further matching ambiguities. We analyze our GOCor\nmodule in extensive ablative experiments. When integrated into state-of-the-art\nnetworks, our approach significantly outperforms the feature correlation layer\nfor the tasks of geometric matching, optical flow, and dense semantic matching.\nThe code and trained models will be made available at\ngithub.com/PruneTruong/GOCor.\n