xavier_uniform_¶
dragon.vm.torch.nn.init.
xavier_uniform_
(
tensor,
gain=1
)[source]¶Fill tensor from a xavier uniform distribution.
\[\text{tensor} \sim \mathcal{U}(-\alpha, \alpha) \\ \, \\ \, \text{where} \quad \alpha = \text{gain} \times \sqrt{\frac{6}{\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.