How could I convolve a 4D image and a 4D filter with stride? I want to create a CNN in Python, specifically, only with NumPy, if possible. For optimizing the time of convolution (actually correlation) in the network, I wanna try to use FFT-based convolution. The data that needs to be convoluted (correlated) is a 4D image tensor with shape [batch_size, width, height, channels] and 4D filter tensor [filter_width, filter_height, in_channel, out_channel]. I read a lot of articles about FFT-based convolution, but they aren't doing it in my way. Thus, I need your help.
How could I fft-convolve a 4D image and a 4D filter with stride?
I think this should work for you:
scipy.signal.correlate | SciPy
I used it myself while I was writing a CNN in numpy.