hi, i research to training for object tracker using pytorch.
i have question about how to assign value in 5-dimension tensor.
code:
tcls = torch.LongTensor(nB, nA, nGh, nGw, nC).fill_(0).cuda()   # create 5-dim tensor
…
gt_index = gt_index_map[fg_index]  # fg_index shape is nA x nGh x nGw
cls_index = t_cls[gt_index]  # get class id from ground truth
print(cls_index)
cls_index = cls_index.view(-1, 1)
print(’------------- First ----------------’)
target = tcls[b][fg_index]
target.scatter_(1, cls_index, 1)
print(target)
print(target.shape)
print(’--------------Second ------------------’)
tcls[b][fg_index].scatter_(1, cls_index, 1)
print(tcls[b][fg_index])
print(tcls[b][fg_index].shape)
print(tcls[b][fg_index].nonzero())
1617×822 2.64 KB
First code was changed greatly! but second code is not changed…
why not change value 0 to 1 in that tensor ??