我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用torch.initial_seed()。
def test_manual_seed(self): rng_state = torch.get_rng_state() torch.manual_seed(2) x = torch.randn(100) self.assertEqual(torch.initial_seed(), 2) torch.manual_seed(2) y = torch.randn(100) self.assertEqual(x, y) torch.set_rng_state(rng_state)
def __getitem__(self, idx): return torch.initial_seed()
def __getitem__(self, idx): self.count.value += 1 if self.count.value == self.num_workers: self.barrier.release() self.barrier.acquire() self.barrier.release() return torch.initial_seed()