A native pytorch implementation would be great. Given two same sized images, this layer is similar to conv2D layer between image1 and a padded image2. But there are relevant differences: firstly there are no weights, image2 takes the place of the filters, secondly the multiplications are not added together only the channels are averaged, thirdly each multiplication between each of the images is stored in a different output channel. Take a look at:

  
      

      GitHub
  

  
    

GitHub - limacv/CorrelationLayer: Pure Pytorch implementation of Correlation... 16

  Pure Pytorch implementation of Correlation Layer that commonly used in learning based optical flow estimator - GitHub - limacv/CorrelationLayer: Pure Pytorch implementation of Correlation Layer tha...


  

  
    
    
  

  


This layer is very useful for optical flow.