def th_linear_fill(layer):
    """
    The default way of linear initialization.
    
    Example:
        from paddleseg.cvlibs import param_init
        import paddle.nn as nn
        
        linear = nn.Linear(128, 128)
        param_init.linear_fill(linear)
    """
    nn.initializer.KaimingUniform(
        negative_slope=math.sqrt(5), nonlinearity='leaky_relu')(layer.weight)

    if getattr(layer, 'bias', None) is not None:
        fan_in = layer.weight.shape[0]
        bound = 1 / math.sqrt(fan_in) if fan_in > 0 else 0
        nn.initializer.Uniform(low=-bound, high=bound)(layer.bias)

    The default way of linear initialization.
    
    Example:
        from paddleseg.cvlibs import param_init
        import paddle.nn as nn
        
        linear = nn.Linear(128, 128)
        param_init.linear_fill(linear)
    
paddleseg/cvlibs/param_init.py