def _load_pretrained_weights(new_layer, previous_layer):
    """Load pretrained weights based on number of input channels"""
    n_in = getattr(new_layer, 'in_channels')
    if n_in == 1:
        new_layer.weight.data = previous_layer.weight.data.sum(dim=1,
            keepdim=True)
    elif n_in == 2:
        new_layer.weight.data = previous_layer.weight.data[:, :2] * 1.5
    else:
        new_layer.weight.data[:, :3] = previous_layer.weight.data
        new_layer.weight.data[:, 3:].zero_()
