Hi all,
I’m performing cross-correlations between images and kernels. But it’s common that I need to perform a cross-correlation on an unique image with many different kernels.
All kernels have the same shape, so a simple solution is to batch them, and duplicate the image along the batch dimension. Doing so, I have the following tensors:
images batch of shape [n_kernels, n_channels, img_h, img_w]
kernels batch of shape [n_kernels, n_channels, krn_h, krn_w]

The cross-correlation operation works as expected, but I will run out of memory quickly: if my images’ size is 200x200px with 128 channels, if I have 50 kernels, I will need to store 200x200x128x50 floats in memory… which is huge.
Is there any way to perform my cross-correlation operations without duplicating my input image?
Thank you