I’m not satisfied with my following solution because I wanted to explicitly construct W and V but I don’t know how to do it without potentially screwing up backprop (due to in-place operations and re-assigments and not knowing how to use .clone() properly). So this is the solution I have right now:
l=2
b_w = mdl[0].bias
W_p = mdl[0].weight
V = mdl[1].weight
regularization = (torch.matmul(V,W_p) + torch.matmul(V,b_w)).norm(l)

I think it should work but it just feels I’m avoiding the main issue which is that I don’t know how to do it by creating a new matrix:
W = [W_p, b_w]
V = mdl[1].weight

and have backprop work properly at the same time.