def load_checkpoint_vars(path):
    """ Load all variables from a checkpoint to a dict.

    Args:
        path(str): path to a checkpoint.

    Returns:
        dict: a name:value dict
    """
    if path.endswith(".npz"):
        ret = dict(np.load(path))
        ret = {get_op_tensor_name(k)[0]: v for k, v in ret.items()}
        return ret
    path = get_checkpoint_path(path)
    reader = tfv1.train.NewCheckpointReader(path)
    var_names = reader.get_variable_to_shape_map().keys()
    result = {}
    for n in var_names:
        result[n] = reader.get_tensor(n)
    return result
 Load all variables from a checkpoint to a dict.

    Args:
        path(str): path to a checkpoint.

    Returns:
        dict: a name:value dict
    
tensorpack/tfutils/varmanip.py