Generate Random Number on device?

I need to sample from a normal distribution in the training process, and is there any way to generate random numbers from device, rather than using torch.normal(mean, variance).cuda(). As when the dimension of normal is large, it seems to be very costly. Thanks!

Hi,

is

t = torch.Tensor(10,10).cuda()
t.normal_()

what you are looking for?

Best regards

Thomas

2 Likes