shlogg · Early preview
Super Kai (Kazuya Ito) @superkai_kazuya

Understanding PyTorch's Normal() Function For Random Number Generation

torch.normal() generates random numbers from normal distribution with mean and std as arguments. It can create tensors of various shapes and data types.

Buy Me a Coffee☕
*Memos:

[Warning]-normal() is really tricky.
You can use manual_seed() with normal(). *My post explains manual_seed().
My post explains rand() and rand_like().
My post explains randn() and randn_like().
My post explains randint() and randperm().

normal() can create the 0D or more D tensor of zero or more random floating-point numbers or complex numbers from normal distribution as shown below:
*Memos:

normal() can be used with torch but not with a tensor.
The 1st argument with torch is mean(Required-Type:float or complex or tensor of float or complex):
*Memos:

Setting mean...