Backpropagation equation for a variant on the usual Linear Neuron architecture
The forward prop equation is:

$$
Z = (X-A)W - B = XW - AW - B
$$

So the derivatives for $Z$ w.r.t $W$, $A$, $B$ and $X$ should be:

$$
\frac{\partial Z}{\partial W} = X-A  \\
\frac{\partial Z}{\partial A} = - W  \\
\frac{\partial Z}{\partial B} = - 1 \\
\frac{\partial Z}{\partial X} = W
$$

I don't know why he needs the last one though. The first is, like you said, as expected. The other two are wrong, I don't know why he used them in the implementation.