I think cdancette answered your question properly
However, I’ll just add that torch.randn(10) * 5 won’t give you floats bewteen -5 and 5, but rather a normal distribution (so for all real numbers) with a sigma of 5, your numbers will only get 68% chance of being inside [-5,5] (more details here 11)
If you want 10 floats between -5 and 5 you should call
torch.rand(10)*10 - 5