PyTorch equivalent of numpy's np.random.RandomState
I'm looking for a way to create random objects without actually altering the pytorch global seed. 

i.e. an equivalent to numpy's: 

rand_gen = np.random.RandomState(seed)
rand_gen.randint(0, 256, self.image_dim))  # for example


You could pass your torch.Generator manually to the random function.
 I think this code should work:

gen0 = torch.Generator()
gen1 = torch.Generator()

gen0 = gen0.manual_seed(0)
gen1 = gen1.manual_seed(1)
torch.rand(5, generator=gen0)
torch.rand(5, generator=gen0)
torch.rand(5, generator=gen1)
torch.rand(5, generator=gen1)

gen0 = gen0.manual_seed(0)
gen1 = gen1.manual_seed(1)
torch.rand(5, generator=gen1)
torch.rand(5, generator=gen1)
torch.rand(5, generator=gen0)
torch.rand(5, generator=gen0)

