Hi all, is there any loop-free way of doing this?
all = torch.zeros(batch, n, dim)

for B in range(batch):
    wpe = torch.zeros(n,dim)
    for i in range(n):
        wpe[w][:] = torch.sum(atten_matrix[B][:][i] * ee.permute(0,2,1),dim=2)
       # ee.permute(0,2,1).size() => batch x dim x L
       # atten_matrix.size() batch x L x L
    all[B] = wpe