def METHOD_NAME(m, init_type='xavier', gain=0.02):
    classname = m.__class__.__name__
    if classname.find('BatchNorm2d') != -1:
        if hasattr(m, 'weight') and m.weight is not None:
            nn.init.normal_(m.weight, 1.0, gain)
        if hasattr(m, 'bias') and m.bias is not None:
            nn.init.constant_(m.bias, 0.0)
    elif hasattr(m, 'weight') and (classname.find('Conv') != -1
                                   or classname.find('Linear') != -1):
        if init_type == 'normal':
            nn.init.normal_(m.weight, 0.0, gain)
        elif init_type == 'xavier':
            nn.init.xavier_normal_(m.weight, gain=gain)
        elif init_type == 'xavier_uniform':
            nn.init.xavier_uniform_(m.weight, gain=1.0)
        elif init_type == 'kaiming':
            nn.init.kaiming_normal_(m.weight, a=0, mode='fan_in')
        elif init_type == 'orthogonal':
            nn.init.orthogonal_(m.weight, gain=gain)
        elif init_type == 'none':  # uses pytorch's default init method
            m.reset_parameters()
        else:
            raise NotImplementedError(
                'initialization method [%s] is not implemented' % init_type)
        if hasattr(m, 'bias') and m.bias is not None:
            nn.init.constant_(m.bias, 0.0)
    elif hasattr(m, 'weight_bar') and (classname.find('Conv') != -1):
        if init_type == 'normal':
            nn.init.normal_(m.weight_bar, 0.0, gain)
        elif init_type == 'xavier':
            nn.init.xavier_normal_(m.weight_bar, gain=gain)
        elif init_type == 'xavier_uniform':
            nn.init.xavier_uniform_(m.weight_bar, gain=1.0)
        elif init_type == 'kaiming':
            nn.init.kaiming_normal_(m.weight_bar, a=0, mode='fan_in')
        elif init_type == 'orthogonal':
            nn.init.orthogonal_(m.weight_bar, gain=gain)
        elif init_type == 'none':  # uses pytorch's default init method
            m.reset_parameters()
        else:
            raise NotImplementedError(
                'initialization method [%s] is not implemented' % init_type)
        if hasattr(m, 'bias') and m.bias is not None:
            nn.init.constant_(m.bias, 0.0)