I get the following results, and it seems to be working fine:
torch.einsum('bk..., bk... -> bk', torch.randn(32, 7, 24, 24, 24), torch.randn(32, 7, 24, 24, 24)).shape
Out[26]: torch.Size([32, 7])

Maybe you need to ensure your tensor’s shape.