Skip to content

Commit

Permalink
update seed setup
Browse files Browse the repository at this point in the history
  • Loading branch information
XinhaoMei committed Jan 11, 2022
1 parent 31b8d6e commit 8cc1abc
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
def setup_seed(seed):

torch.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
if torch.cuda.is_available():
torch.cuda.manual_seed(seed)
torch.cuda.manual_seed_all(seed)
np.random.seed(seed)
random.seed(seed)
torch.backends.cudnn.deterministic = True
Expand Down

0 comments on commit 8cc1abc

Please sign in to comment.