x = Tensor(B,C,D)
y = Tensor(B,D)
If you want simplicity, you can just element-wise multiply them, then sum along that dimension:
(x * y.reshape(B,1,D)).sum(dim=2)
If you want to save memory, you can either use einsum():
torch.einsum('bcd,bd->bc', x, y)
or use bmm():
torch.bmm(x, y.rehsape(B,D,1)).reshape(B,C)