It’s a little tricky.

import torch

a=torch.rand(3)

a
Out[3]: tensor([0.3544, 0.3355, 0.4885])

a.size()
Out[4]: torch.Size([3])

b=torch.rand(4,3)

b.size()
Out[6]: torch.Size([4, 3])


Here if you do torch.cat((b,a)) you will get an error because size of a is 3
c=torch.cat((b,a))
Traceback (most recent call last):

  File "<ipython-input-7-cc137009b380>", line 1, in <module>
    c=torch.cat((b,a))

RuntimeError: invalid argument 0: Tensors must have same number of dimensions: got 2 and 1 at /pytorch/aten/src/TH/generic/THTensorMath.cpp:3607

So you have to unsqueeze a to get a size 1,3
c=torch.cat((b,a.unsqueeze(0)))