I just needed differentiation with respect to parameters of the distribution and found out that truncated normal distribution is not bundled intorch.distributionsas of 1.6.0. Known issues icdfis numerically unstable; as a consequence, so isrsample. This issue is also seen intorch.distributions.norma...
(): return tensor.normal_(mean, std) def _no_grad_trunc_normal_(tensor, mean, std, a, b): # Method based on https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf def norm_cdf(x): # Computes standard normal cumulative distribution function return (1. + math.erf(x...
"mean is more than 2 std from [a, b] in nn.init.trunc_normal_. " "The distribution of values may be incorrect.", stacklevel=2, ) with torch.no_grad(): # Values are generated by using a truncated uniform distribution and Expand All @@ -48,7 +51,7 @@ def norm_cdf(x): tens...
Whendfindependent random variables, each with standard normal distributions (mean 0, variance 1), are squared and summed, the resulting distribution is chi-square (see Notes). This distribution is often used in hypothesis testing. ###Parameters df : int Number of degrees of freedom. size : tu...