test_utils.py 文件源码

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

项目:crnn 作者: wulivicte 项目源码 文件源码
def checkOneHot(self):
        v = torch.LongTensor([1, 2, 1, 2, 0])
        v_length = torch.LongTensor([2, 3])
        v_onehot = utils.oneHot(v, v_length, 4)
        target = torch.FloatTensor([[[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 0]],
                                    [[0, 1, 0, 0], [0, 0, 1, 0], [1, 0, 0, 0]]])
        assert target.equal(v_onehot)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号