How to put a list of tensor into a new tensor?

I have a list ,each element in the list is a tensor has the shape as (channel,width), where width of each tensor are different, but channel are all same; I want to put the list of tensors in to a tensor has the shape as :

(listlength, channel, maxwidth), how could I realize this without using loop?

Use torch.stack

x = torch.randn((3,4))
y = torch.randn((3,4))
z = torch.stack([x,y], dim=0)

thank you. but each tensor in the list has different length; It can not directly use stack function.

Have you tried using padding?

Yes, I use the padding. and I use the pack_padded_sequence,
I then fed the output of pack_padded sequence into LSTM, and I got the two output from
LSTM: output and hiddenstate. I want to use the hiddenstate for further processing. But I
am not very clear about the hiddenstate which are calculated by the packed sequence, I think
I sould desort the hiddenstate, and should I unpad it? Could anybody give me some light on