I am in the process of implementing a Message Passing Neural Network In PyTorch. Lots of implementations I see introduce zero-padding in order to fit the framework but this actually means that the implementations do not match the theory described in the reference papers especially when things like batch norm are introduced.
A true implementation would be possible if we could make use of something like numpy.repeat where each element can be repeated a certain number of times i.e.
> import numpy as np
> x = [1,2,3]
> np.repeat(x,x)
array([1, 2, 2, 3, 3, 3])
we would then have a separate array to allow us to perform sums over the numbers of repeated elements depending on the numbers of neighbours.
I appreciate that such an implementation could be slower than zero-padding but the main concern in my work is being true to the physical system and to examine how true implementations differ from those that are available.