Oh I see, I guess this helps you.
import torch
import matplotlib.pyplot as plt

image1 = torch.randn(size= (40,40))
image2 = torch.randn(size = (40,40))

width = image1.size(0) + image2.size(0)
height = image1.size(1)

image3 =torch.zeros(size = (height,width))

image3[:height,:int(width/2)] = image1
image3[:height,int(width/2):width] = image2

plt.imshow(image3)
plt.show()

Or you can check make_grid function in torchvision.utils