The docu says:

All tensors must either have the same shape (except in the cat dimension) or be empty.

This example demonstrates you error:
a = torch.randn(10, 10)
b = torch.randn(10, 20)
c = torch.cat((a, b), dim=0)
>> RuntimeError

This will give the RuntimeError you are seeing, because I tried to cat both tensors in dimension 0, even though the size is different in dimension 1.
However,
c = torch.cat((a, b), dim=1)

will be fine.