I find the code a bit hard to follow. I would rather define variables `proj_grad_W` and `proj_grad_H` and compute the Frobenius norms of those.