Hi,
I think the problem is that you do an element-wise product when you do g * v instead of a dot product.
Does elem_prod = sum([(g * v).sum() for g, v in zip(grads, list_of_v)]) compute what you want?