Just like what you said above, if I want to initialize two linear layers with the same weights right now, I’d have to do
import torch
from torch import nn

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

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

This forces me to leave torch.manual_seed(3) everywhere if I have a lot of linears and want to make sure they all initialize to the same weights. Is there a function (let’s call it torch.fix_global_seed) such that if I do
import torch
from torch import nn

torch.fix_global_seed(3)
linear = nn.Linear(5, 2)
linear2 = nn.Linear(5, 2)
linear3 = nn.Linear(5,2)
linear4 = nn.Linear(5,2)

All four linears would be initialized with the same weight?