xavier_normal_

dragon.vm.torch.nn.init.xavier_normal_(
  tensor,
  gain=1
)[source]

Fill tensor from a xavier normal distribution.

\[\text{tensor} \sim \mathcal{N}(0, \sigma^{2}) \\ \, \\ \, \text{where} \quad \sigma = \text{gain} \times \sqrt{\frac{2}{\text{fan\_in} + \text{fan\_out}}} \]
Parameters:
  • tensor (dragon.vm.torch.Tensor) – The input tensor.
  • gain (number, optional, default=1) – The gain value.
Returns:

dragon.vm.torch.Tensor – The input tensor.