How to concatenate list of pytorch tensors?
This is my current solution <SCODE> data = th.zeros([len(imgs), imgs[0].size()[0], imgs[0].size()[1], imgs[0].size()[2]])
 for i, img in enumerate(imgs): 
       print(img.size())
       print(img.type())
       data[i] = img<ECODE>
erogol
fmassa
just in case you were wondering about the difference: stack cat
Brando_Miranda
What if A is of shape (1,3,4) and B is (3,4)? I want the result to be (2,3,4). How do I do this?
Hiperdyne19012
<SCODE>a = torch.rand(1, 3, 4)
print(a.shape)
b = torch.rand(3, 4)
print(b.shape)
b = b.unsqueeze(0)
print(b.shape)
c = torch.cat([a, b], dim=0)
print(c.shape)
<ECODE>
harsha_g
Thank you, it works.
Hiperdyne19012