def load_data(self, file_name):
with open(file_name, 'rb') as file:
unpickler = pickle._Unpickler(file)
unpickler.encoding = 'latin1'
contents = unpickler.load()
X, Y = np.asarray(contents['data'], dtype=np.float32), np.asarray(contents['labels'])
one_hot = np.zeros((Y.size, Y.max() + 1))
one_hot[np.arange(Y.size), Y] = 1
return X, one_hot
dataset.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录