API symbolsnn
Copy
tensorplay.nn.init.trunc_normal_
- tensorplay.nn.init.trunc_normal_(tensor, mean=0.0, std=1.0, a=-2.0, b=2.0)[source]
Fills the input Tensor with values drawn from a truncated normal distribution.
Method is based on the rejection-sampling scheme in https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf — a direct port of
torch.nn.init._no_grad_trunc_normal_(torch/nn/init.py), which torchvision transformer models use for positional embeddings.
Help improve this page
Found an error, an unclear step, or a missing example?
Was this page helpful?
