Solved by tom in post #2 
              
              
                Modifying parameters this way doesn’t work. 
In my opinion the best way to do this is to create your own layer using W and K as parameters and using torch.nn.functional.linear in the forward. 
for the multiplication, (provided m is even), I’d probably suggest 
   mul = torch.ones(2, 1, 1, device=K.d…