type or paste code here

Hi, I am working on optical flow projects, and most of the methods utilizes the correlation of two feature maps to get the similarity. However,  some researchers implement the CUDA programming on correlation, like FlowNet and PWC-net; while others calculate all pairs correlation like, (RAFT, https://arxiv.org/pdf/2003.12039.pdf 11). Could Pytorch support a correlation operator for us? Or can we easily implement the method using existing operators.
The calculation is straightforward.
cost_volume = corr(fmap1, fmap2, search_range)
given fmap1[B, H, W, C] and fmap2[B, H, W, C], search_range=3 (a radius of search range)
The cost_volume should be [B, H, W, 49]. which stores the correlation value between each feature in fmap1 and its corresponding n