对描述进行处理
scores, caps_sorted, decode_lengths, alphas, sort_ind = decoder(imgs, caps, caplens)
# Since we decoded starting with <start>, the targets are all words after <start>, up to <end>
targets = caps_sorted[:, 1:]
print(targets)
輸出:(輸出結果應該是對以下的張量進行索引,索引查表從而映射描述)
tensor([[ 1, 99, 64, ..., 0, 0, 0],[ 1, 610, 42, ..., 0, 0, 0],[ 1, 87, 8, ..., 0, 0, 0],...,[ 1, 46, 54, ..., 0, 0, 0],[262, 105, 67, ..., 0, 0, 0],[114, 22, 902, ..., 0, 0, 0]], device='cuda:0')總結
- 上一篇: 打印Show Attend and Te
- 下一篇: 输出每一步的损失