MCPcopy Create free account
hub / github.com/IRMVLab/SemGauss-SLAM / seed_everything

Function seed_everything

utils/common_utils.py:9–23  ·  view source on GitHub ↗

Set the `seed` value for torch and numpy seeds. Also turns on deterministic execution for cudnn. Parameters: - seed: A hashable seed value

(seed=42)

Source from the content-addressed store, hash-verified

7
8
9def seed_everything(seed=42):
10 """
11 Set the `seed` value for torch and numpy seeds. Also turns on
12 deterministic execution for cudnn.
13
14 Parameters:
15 - seed: A hashable seed value
16 """
17 random.seed(seed)
18 os.environ["PYTHONHASHSEED"] = str(seed)
19 np.random.seed(seed)
20 torch.manual_seed(seed)
21 torch.backends.cudnn.deterministic = True
22 torch.backends.cudnn.benchmark = False
23 print(f"Seed set to: {seed} (type: {type(seed)})")
24
25def params2cpu(params):
26 res = {}

Callers 1

sem_gauss.pyFile · 0.90

Calls 1

printFunction · 0.85

Tested by

no test coverage detected