当偏移量有两个数字时,我知道它的含义,但是当有多于两个数字时,例如:
weight = torch.FloatTensor([[1, 2, 3], [4, 5, 6]])
embedding_sum = nn.EmbeddingBag.from_pretrained(weight, mode='sum')
print(list(embedding_sum.parameters()))
input = torch.LongTensor([0,1])
offsets = torch.LongTensor([0,1,2,1])
print(embedding_sum(input, offsets))
结果是:
[Parameter containing:
tensor([[1., 2., 3.],
[4., 5., 6.]])]
tensor([[1., 2., 3.],
[4., 5., 6.],
[0., 0., 0.],
[0., 0., 0.]])
who can help me?