deal_code.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:LoginSimulation 作者: Byshx 项目源码 文件源码
def _one_hot_(label, num_classes=36):

        num_labels = label.shape[0]
        index_offset = np.arange(num_labels) * num_classes
        labels_one_hot = np.zeros((num_labels, num_classes))
        labelNum = []
        # ???1???????
        for i in label:
            # ???
            if ord(i) <= 57:
                chrvalue = ord(i) - 48
            else:
                # ???????????????10??????10
                chrvalue = ord(str(i).upper()) - 65 + 10
            labelNum.append(chrvalue)
        newlabel = np.array(labelNum)
        labels_one_hot = labels_one_hot.astype(np.float32)
        labels_one_hot.flat[index_offset + newlabel.ravel()] = 1.
        return labels_one_hot
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号