Solved by tom in post #2 
              
              
                At the risk of being blunt: Using  .data has been a bad idea for more than half a year. 
When you try to assign .weight and .bias, PyTorch will tell you exactly what to do, i.e. have a nn.Parameter to assign (I know, because I tried with a tensor before that): 
l = torch.nn.Linear(5, 4)
x = torch.ra…