on another note, can you help me understand what loc = (dsum==0).nonzero() does?
so if the output of (dsum==0) is
  0  0  1  0  0  0
  0  0  0  1  0  0

then
(dsum==0).nonzero()
gives us
 0  0  2
 0  1  3

I understand that 2 and 3 are the indices, but what is 1 here?