(x)
| 493 | # Cut & paste from PyTorch official master until it's in a few official releases - RW |
| 494 | # Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf |
| 495 | def norm_cdf(x): |
| 496 | # Computes standard normal cumulative distribution function |
| 497 | return (1. + math.erf(x / math.sqrt(2.))) / 2. |
| 498 | |
| 499 | if (mean < a - 2 * std) or (mean > b + 2 * std): |
| 500 | warnings.warn("mean is more than 2 std from [a, b] in nn.init.trunc_normal_. " |
no outgoing calls
no test coverage detected