def get_init_function()

in mico/utils/net_utils.py [0:0]


def get_init_function(init_value):
    """This is for the initialization of the Prior and Posterior model.
    We can change the scale of the initialization by the argument `init_value`.
    """
    def init_function(m):
        if init_value > 0.:
            if hasattr(m, 'weight'):
                m.weight.data.uniform_(-init_value, init_value)
            if hasattr(m, 'bias'):
                m.bias.data.fill_(0.)

    return init_function