tensor 序列化成bytes再转成hex字符串(16进制)互转

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_37674858/article/details/88634881
def hex_to_fea(fea_hex):
    fea_bytes = bytes.fromhex(fea_hex)
    feature=pickle.loads(fea_bytes)
    return feature

def feature_pickle_base(feature):
    fea_pik=pickle.dumps(feature)
    fea_hex =fea_pik.hex() # tensor 序列化成bytes再转成hex字符串(16进制)
    return fea_hex

猜你喜欢

转载自blog.csdn.net/qq_37674858/article/details/88634881