Most of the stock init functions use it these days, see torch/nn/init.py.
Best regards
Thomas

  
      github.com
  
  
    pytorch/pytorch/blob/master/torch/nn/init.py 38
import math
import random
import warnings

import torch


def calculate_gain(nonlinearity, param=None):
    r"""Return the recommended gain value for the given nonlinearity function.
    The values are as follows:

    ================= ====================================================
    nonlinearity      gain
    ================= ====================================================
    Linear / Identity :math:`1`
    Conv{1,2,3}D      :math:`1`
    Sigmoid           :math:`1`
    Tanh              :math:`\frac{5}{3}`
    ReLU              :math:`\sqrt{2}`
    Leaky Relu        :math:`\sqrt{\frac{2}{1 + \text{negative_slope}^2}}`


  This file has been truncated. show original