You could add an additional dimension at dim1 in b and let broadcasting do the rest:
a = torch.randn(10, 3, 24, 24)
b = torch.randn(10, 24, 24)

c = torch.stack((torch.bmm(a[:,0,:,:],b), torch.bmm(a[:,1,:,:],b), torch.bmm(a[:,2,:,:],b)), dim=1)     

d = torch.matmul(a, b.unsqueeze(1))
(c == d).all()