r"""Fills tensor with random values sampled from :math:`\mathcal{N}(0, \text{std}^2)` where .. math:: \text{std} = \text{gain} \times \sqrt{\frac{2}{\text{fan_in} + \text{fan_out}}} Also known as Glorot initialization. Detailed information can be retrieved from `Understand
(tensor: Tensor, gain: float = 1.0)
| 197 | |
| 198 | |
| 199 | def xavier_normal_(tensor: Tensor, gain: float = 1.0) -> None: |
| 200 | r"""Fills tensor with random values sampled from |
| 201 | :math:`\mathcal{N}(0, \text{std}^2)` where |
| 202 | |
| 203 | .. math:: |
| 204 | |
| 205 | \text{std} = \text{gain} \times \sqrt{\frac{2}{\text{fan_in} + \text{fan_out}}} |
| 206 | |
| 207 | Also known as Glorot initialization. Detailed information can be retrieved from |
| 208 | `Understanding the difficulty of training deep feedforward neural networks` - |
| 209 | Glorot, X. & Bengio, Y. (2010). |
| 210 | |
| 211 | Args: |
| 212 | tensor: tensor to be initialized. |
| 213 | gain: scaling factor for :math:`std`. |
| 214 | """ |
| 215 | fan_in, fan_out = calculate_fan_in_and_fan_out(tensor) |
| 216 | std = gain * math.sqrt(2.0 / float(fan_in + fan_out)) |
| 217 | normal_(tensor, 0.0, std) |
| 218 | |
| 219 | |
| 220 | def msra_uniform_( |
nothing calls this directly
no test coverage detected