MCPcopy Create free account
hub / github.com/XLearning-SCU/2022-CVPR-DART / set_seed

Function set_seed

utils.py:165–171  ·  view source on GitHub ↗
(seed, cuda=True)

Source from the content-addressed store, hash-verified

163 self.file.close()
164
165def set_seed(seed, cuda=True):
166 random.seed(seed)
167 np.random.seed(seed)
168 torch.manual_seed(seed)
169 if cuda:
170 torch.backends.cudnn.deterministic = True
171 torch.cuda.manual_seed(seed)
172
173def set_requires_grad(nets, requires_grad=False):
174 """Set requies_grad=Fasle for all the networks to avoid unnecessary computations

Callers 1

run.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected