Setting up a random seed can ensure that the initial value of the random number is the same in each experiment;
that is, it can ensure that each experiment is in the same initial state;
import random, torch
import numpy as np
seed = 1
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
Where seed = 1 represents the random value numbered 1, which is a set of random values;
it can also be replaced with other integer numbers, such as 123, 456, etc.;
usually, different random seed values represent different experimental groups;