How to create a Label Tensor

Hi all,
I have 10 classes(indices or labels 0…9) with different shapes i.e

class 1 to class 10 shapes: [14, 2, 128] , [16, 2, 128], [15, 2, 128], [20, 2, 128],[15, 2, 128],[20, 2, 128], [10, 2, 128], [11, 2, 128], [7, 2, 128]

I want to create a label tensor of 128 batch size using the first value from each shape tensor so that label tensor consist of 14 values of index 0 , 16 values of index 1,

15 values of index 2 and likewise.

Any help in this regard will be highly appreciated.

Cheers,
Angelina

Hi,

You can take all of these Tensors in a list and concatenate them to get a single Tensor will all of the content: out = torch.cat(your_list, dim=0).