>>> import torch >>> a = torch.randn([2, 3, 4]) >>> b = torch.randn([2, 3]) >>> b = b.unsqueeze(dim=2) >>> b.shape torch.Size([2, 3, 1]) >>> torch.cat([a, b], dim=2).shape torch.Size([2, 3, 5])