Spaces:
Sleeping
Sleeping
File size: 401 Bytes
e9e75df |
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 26 |
import random
try:
import numpy as np
HAS_NP = True
except Exception:
HAS_NP = False
try:
import torch
HAS_TORCH = True
except Exception:
HAS_TORCH = False
def pytest_runtest_setup(item):
# Fix seeds at the beginning of each test.
seed = 20220714
random.seed(seed)
if HAS_NP:
np.random.seed(seed)
if HAS_TORCH:
torch.manual_seed(seed)
|