python numpy读取二进制数据
import numpy as np
q_f = open('weight','rb')
weight = np.fromfile(q_f, dtype=np.int16)
weight = np.reshape(weight,(512,512)).T
weight = weight.flatten()
q_f.close()
fo = open("weight2", "wb")
fo.write(weight)
fo.close()
import numpy as np
q_f = open('weight','rb')
weight = np.fromfile(q_f, dtype=np.int16)
weight = np.reshape(weight,(512,512)).T
weight = weight.flatten()
q_f.close()
fo = open("weight2", "wb")
fo.write(weight)
fo.close()