# -*- coding: utf-8 -*-
import numpy
import numpy as np
import torch
import sys
from collections import OrderedDict
import scipy.stats
import pandas as pd
from model import *
# from audtorch.metrics.functional import pearsonr
import math


# 该函数用于读出全精度、量化模型的weight和bias值，以作观察
if __name__ == "__main__":

    d1 = sys.argv[1]
    # d2 = sys.argv[2]
    # d1=8
    # df = pd.read_csv('./ptq_analysis_data/seperate_data.csv', index_col=0)
    df = pd.DataFrame()
    # df2 = pd.DataFrame()
    base_data = torch.load('./project/p/ckpt/trail/model_trail.pt')
    # checkpoint_data = torch.load('./project/p/ckpt/trail/model_trail.pt')
    print('full_precision weight/bias loaded!')

    checkpoint_dir = './project/p/checkpoint/cifar-10_trail_model'

    # quan_data = torch.load('ckpt/cifar-10_lenet_bn_ptq_' + str(d1) + '_.pt')
    # print('quantization bit ' + str(d1) + ' weight/bias loaded!')


    sum=0
    
    if int(d1) == 1:
        print(base_data)
        # for k, _ in base_data.items():
        #     base_data[k] = base_data[k].reshape(1, -1)
        #     # quan_data[k] = quan_data[k].reshape(1, -1)
        #     print(base_data[k])

    else:
        for i in [4,9,14,19]:
            check_data =  torch.load(checkpoint_dir + '/ckpt_cifar-10_trail_model%s.pt' % (str(i)))
            print(check_data)
            


        # if int(d2) == 1:
        #     print(base_data[k])
        # else:
        #     print(quan_data[k])






