I just spent three hours chasing a code bug which turned out to be me being stupid. Oddly enough, gain[eta-1][phi-1][depth-1] += (w[layer-1] * e0 * ws_fc[eta-1][phi-1][layer-1][depth-1]); doesn't give the right answers if you're supposed to DIVIDE by ws_fc. I'm an idiot. That is all. Wanna kill these ads? We can help!