Yes, you actually do the same sum on the commented line just above without the np 
If it happens during the forward, you can add a few prints in your code to find out where it appears.
If it is during the backward, you can enable the anomaly detection 16 to know where it appears in the backward.