-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathset_seed.py
25 lines (23 loc) · 971 Bytes
/
set_seed.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import torch
import torch.nn.functional as F
import torch_geometric as pyg
import numpy as np
import random
import open3d as o3d
def set_reproducibility(seed=1000, report=True):
random.seed(seed)
np.random.seed(seed)
torch.manual_seed(seed)
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
torch.backends.cudnn.benchmark = False
#torch.backends.cudnn.deterministic = True
pyg.seed.seed_everything(seed)
if report:
print()
print('************************Reproducibility Mode******************************')
print('** **')
print('** Set the random seed for random, np.random, torch and cudnn as {:4d}. **'.format(seed))
print('** **')
print('**************************************************************************')
print()