For details check out: https://pytorch.org/docs/stable/notes/randomness.html
Seed points should be set at the beginning of an application.
import torch
import random
import numpy as np
seed = 0
torch.manual_seed(seed)
# The PyTorch docs state that the command above is sufficient for both CPU and CUDA
# torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)