运行glounts包,IndexError: tensors used as indices must be long, byte or bool tensors

在运行基于gluonts包的scoregard模型时出现IndexError: tensors used as indices must be long, byte or bool tensors

不知道你这个问题是否已经解决, 如果还没有解决的话:
  • 这篇博客: 行人重识别深度学习踩坑笔记中的 3. IndexError: tensors used as indices must be long, byte or bool tensors 部分也许能够解决你的问题, 你可以仔细阅读以下内容或者直接跳转源博客中阅读:
    p_local_features = local_features[p_inds]   # N*H * C  
    # p_inds是一个floatTensor 利用.long()转化为整形
    # IndexError: tensors used as indices must be long, byte or bool tensors
    # 要将tensor作为索引使用,tensor必须是一个long byte或者bool tensor
    p_inds, n_inds = p_inds.long(), n_inds.long()
    

如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^