U Ph@s2ddlmZddlZddlZddZd d d ZdS) ) annotationsNc Csdd}t||||}||||}|d|dd|d|||td|||j||d|W5QRSQRXdS)aTensor initialization with truncated normal distribution. Based on: https://people.sc.fsu.edu/~jburkardt/presentations/truncated_normal.pdf https://github.com/rwightman/pytorch-image-models Args: tensor: an n-dimensional `torch.Tensor`. mean: the mean of the normal distribution. std: the standard deviation of the normal distribution. a: the minimum cutoff value. b: the maximum cutoff value. cSsdt|tddS)N?@)matherfsqrt)xr V/home/dell461/cl/sdc2/HISourceFinder-master-l/src/monai/networks/layers/weight_init.pynorm_cdf!sz(_no_grad_trunc_normal_..norm_cdfr)minmaxN) torchno_graduniform_erfinv_mul_rradd_clamp_)tensormeanstdabr lur r r _no_grad_trunc_normal_s  rrrcCs0|dkrtd||kr tdt|||||S)aqTensor initialization with truncated normal distribution. Based on: https://github.com/rwightman/pytorch-image-models Args: tensor: an n-dimensional `torch.Tensor` mean: the mean of the normal distribution std: the standard deviation of the normal distribution a: the minimum cutoff value b: the maximum cutoff value rz3the standard deviation should be greater than zero.zIminimum cutoff value (a) should be smaller than maximum cutoff value (b).) ValueErrorr)rrrrrr r r trunc_normal_/s r")rrr r) __future__rrrrr"r r r r  s