I have a vector
atten and a tensor
feat. The shapes are:
torch.Size([13, 1024, 7, 7])
I want to do below calculation:
sum_i(atten[i] * feat[i])
* directly, but it didn’t work. Does anybody know how to make it right?
torch.einsum('i,ijkl', atten, feat)
thanks! but I’m using pytorch 0.3 which seems not having
That’s a great occasion to upgrade! I don’t think its a reason in itself, but you’ll likely soon find yourself in a similar situation with something else. Just not having to fiddle with variables would be a good reason for me to upgrade.
yes, your solution works~谢了兄弟！