我有一个LongTensor,它包含我想从另一个张量获得的所有索引。如何将此LongTensor转换为可用作选择掩码的ByteTensor。将longtensor格式的索引转换为火炬中的二进制选择掩码
假设,
th> imageLabels:size()
17549
3
[torch.LongStorage of size 2]
[0.0001s]
th> indices
1
22
32
[torch.LongTensor of size 3]
我需要一种方法使用[index]
标记访问imageLabels这样我就可以在原地imageLabels改变一些值。
有没有办法做到这一点?据我从文档中了解到,索引:窄操作返回一个全新的张量。