Solved by albanD in post #2 
              
              
                The reason is because generating some numbers change the state of the random number generator. 
If you set the seed back and the create the layer again, you will get the same weights: 
import torch
from torch import nn

torch.manual_seed(3)
linear = nn.Linear(5, 2)

torch.manual_seed(3)
linear2 = nn…