Skip to content

Instantly share code, notes, and snippets.

@monk1337
Created June 7, 2018 15:29
Show Gist options
  • Save monk1337/d4a68e11aa16b6d54b9e388ba8bb0207 to your computer and use it in GitHub Desktop.
Save monk1337/d4a68e11aa16b6d54b9e388ba8bb0207 to your computer and use it in GitHub Desktop.
#normal distribution with mean=0 var=1
print(torch.rand(1,20,dtype=torch.float))
print(torch.rand(1,20,dtype=torch.double))
# output:
# tensor([[ 0.4976, 0.5590, 0.4242, 0.3130, 0.4160, 0.2188, 0.5643,
# 0.8620, 0.6020, 0.0883, 0.2870, 0.5136, 0.8119, 0.7638,
# 0.3188, 0.1961, 0.3527, 0.9613, 0.2914, 0.3882]])
# tensor([[ 0.9707, 0.9771, 0.0904, 0.0374, 0.7983, 0.4952, 0.2216,
# 0.4408, 0.5823, 0.0330, 0.5291, 0.1843, 0.8370, 0.3423,
# 0.4049, 0.2252, 0.3769, 0.0358, 0.0764, 0.6697]], dtype=torch.float64)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment