This is the example
image_batch1 = torch.rand(16,3,32,32)
image_batch2 = torch.rand(16,3,32,32)

cat1 = torch.cat([image_batch1, image_batch2], dim=0)
print(cat1.shape)
# result is torch.Size([32, 3, 32, 32])

cat2 = torch.cat([image_batch1, image_batch2], dim=1)
print(cat2.shape)
# result is torch.Size([16, 6, 32, 32])