r"""Fills tensor wilth random values sampled from :math:`\mathcal{N}(0, \text{std}^2)` where .. math:: \text{std} = \sqrt{\frac{2}{(1 + a^2) \times \text{fan_in}}} Detailed information can be retrieved from `Delving deep into rectifiers: Surpassing human-level performance
(
tensor: Tensor, a: float = 0, mode: str = "fan_in", nonlinearity: str = "leaky_relu"
)
| 249 | |
| 250 | |
| 251 | def msra_normal_( |
| 252 | tensor: Tensor, a: float = 0, mode: str = "fan_in", nonlinearity: str = "leaky_relu" |
| 253 | ) -> None: |
| 254 | r"""Fills tensor wilth random values sampled from |
| 255 | :math:`\mathcal{N}(0, \text{std}^2)` where |
| 256 | |
| 257 | .. math:: |
| 258 | |
| 259 | \text{std} = \sqrt{\frac{2}{(1 + a^2) \times \text{fan_in}}} |
| 260 | |
| 261 | Detailed information can be retrieved from |
| 262 | `Delving deep into rectifiers: Surpassing human-level performance on ImageNet |
| 263 | classification` |
| 264 | |
| 265 | Args: |
| 266 | tensor: tensor to be initialized |
| 267 | a: optional parameter for calculating gain for leaky_relu. See |
| 268 | :func:`calculate_gain` for details. |
| 269 | mode: fan_in" or "fan_out", used to calculate :math:`gain`, the |
| 270 | scaling factor for :math:`gain`. See :func:`calculate_fan_in_and_fan_out` for |
| 271 | details. |
| 272 | nonlinearity: name of the non-linear function used to calculate :math:`gain`. |
| 273 | See :func:`calculate_gain` for details. |
| 274 | """ |
| 275 | fan = calculate_correct_fan(tensor, mode) |
| 276 | gain = calculate_gain(nonlinearity, a) |
| 277 | std = gain / math.sqrt(fan) |
| 278 | normal_(tensor, 0, std) |
nothing calls this directly
no test coverage detected