Custom function in conv layer

as the conv layer performs the sum of the elementwise product between two arrays A and B

Screenshot (89)

however , I would like to use the same iteration mechanism to perform a custom operation as follows:

Screenshot (88)

for those who might notice that this equation is the Kullback–Leibler divergence, indeed I want to perform the KL div between 2d arrays that have different sizes that’s why I need the sliding mechanism from the conv layer to run kl iteratively…

Hi Yuri!

Please take a look at Unfold (or unfold()).

Here is a discussion about using unfold() for a custom convolution (with
links to further discussion):


K. Frank

thank you, I have also found this discussion that clearly explains the fold unfold process