def METHOD_NAME(m, init_func, obj):
    if len(list(m.children())) > 0:
        if m == obj:
            return
        METHOD_NAME(m, init_func, m)
    else:
        try:
            init_func(m)
        except Exception as e:
            print('initialize layer {} failed, exception is :{}'.format(m, e))