//  [python]
def restore_variables(sess,path,exclude=None,only_scope=None,silent=False,restore_evckp=True,value_key=None,exclude_var=None,extend_vars=None,global_scopes=None,verbose=False):
    #if restore_evckp and os.path.isdir(path):
    #    evt.WEvalModel.restore_ckp(FLAGS.check_point_dir)
    bn_ops = tf.get_collection(key=tf.GraphKeys.UPDATE_OPS)
    bn_ops = [x.name for x in bn_ops]
    print("batch_norm_ops.")
    wmlu.show_list(bn_ops)
    if exclude is None and exclude_var is not None:
        exclude = exclude_var
    file_path = wmlt.get_ckpt_file_path(path)
    if file_path is None:
        return False
    print(f"resotre from {file_path}.")
    for v in tf.global_variables():
        if "moving_mean" in v.name or "moving_variance" in v.name:
            tf.add_to_collection(tf.GraphKeys.MOVING_AVERAGE_VARIABLES,v)
    variables = []
    variables_restored_in_ckpt = []
    variables0 = restore_variables_by_key(sess,file_path,exclude,only_scope,key=tf.GraphKeys.TRAINABLE_VARIABLES,name="train",silent=silent,value_key=value_key)

    if len(variables0)>1:
        if isinstance(variables0[1],list):
            for v in variables0[1]:
                variables.append(v.name)
                variables_restored_in_ckpt.append(v.name)
        else:
            for k,v in variables0[1].items():
                variables.append(v.name)
                variables_restored_in_ckpt.append(k)
    variables1 = restore_variables_by_key(sess,file_path,exclude,only_scope,key=tf.GraphKeys.MOVING_AVERAGE_VARIABLES,name='moving',silent=silent,value_key=value_key)
    if len(variables1)>1:
        if isinstance(variables1[1],list):
            for v in variables1[1]:
                variables.append(v.name)
                variables_restored_in_ckpt.append(v.name)
        else:
            for k,v in variables1[1].items():
                variables.append(v.name)
                variables_restored_in_ckpt.append(k)

    if global_scopes is not None:
        variables2 = restore_variables_by_key(sess,file_path,None,global_scopes,key=tf.GraphKeys.GLOBAL_VARIABLES,name='global_variables',silent=silent,value_key=value_key)
        if len(variables2)>1:
            if isinstance(variables2[1],list):
                for v in variables2[1]:
                    variables.append(v.name)
                    variables_restored_in_ckpt.append(v.name)
            else:
                for k,v in variables2[1].items():
                    variables.append(v.name)
                    variables_restored_in_ckpt.append(k)

    if extend_vars is not None:
        variables2 = restore_variables_by_var_list(sess,file_path,extend_vars)
        if len(variables2)>1:
            if isinstance(variables2[1],list):
                for v in variables2[1]:
                    variables.append(v.name)
                    variables_restored_in_ckpt.append(v.name)
            else:
                for k,v in variables2[1].items():
                    variables.append(v.name)
                    variables_restored_in_ckpt.append(k)

    for i,v in enumerate(variables):
        index = v.find(':')
        if index>0:
            variables[i] = variables[i][:index]
    for i,v in enumerate(variables_restored_in_ckpt):
        index = v.find(':')
        if index>0:
            variables_restored_in_ckpt[i] = variables_restored_in_ckpt[i][:index]

    unrestored_variables = wmlt.get_variables_unrestored(variables_restored_in_ckpt,file_path,
                                                         exclude_var="Adam")
    unrestored_variables0 = wmlt.get_variables_unrestoredv1(variables,exclude_var="Adam")
    if not verbose:
        def v_filter(x:str):
            #return (not x.endswith("ExponentialMovingAverage")) and (not x.endswith("/u"))
            return (not x.endswith("ExponentialMovingAverage")) and (not x.endswith("Momentum"))
        unrestored_variables = filter(v_filter,unrestored_variables)
        unrestored_variables0 = filter(v_filter,unrestored_variables0)
    show_values(unrestored_variables, "Unrestored variables in ckpt")
    show_values(unrestored_variables0, "Unrestored variables of global variables")
    return True