Python torch 模块,initial_seed() 实例源码

我们从Python开源项目中,提取了以下7个代码示例,用于说明如何使用torch.initial_seed()

项目:pytorch-dist    作者:apaszke    | 项目源码 | 文件源码
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)
项目:pytorch    作者:tylergenter    | 项目源码 | 文件源码
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)
项目:pytorch-coriander    作者:hughperkins    | 项目源码 | 文件源码
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)
项目:pytorch    作者:ezyang    | 项目源码 | 文件源码
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)
项目:pytorch    作者:pytorch    | 项目源码 | 文件源码
def __getitem__(self, idx):
        return torch.initial_seed()
项目:pytorch    作者:pytorch    | 项目源码 | 文件源码
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()
项目:pytorch    作者:pytorch    | 项目源码 | 文件源码
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)