Hi,
Excuse me, if you have a tensor like this:
tensor([[[ 1.1937, -0.7235, -0.1802, -0.5610],
         [-0.7524,  1.3047, -1.5577,  1.8352],
         [ 1.1573, -1.8952,  0.4175, -0.2085]],

        [[ 0.4069, -0.1069, -0.3838, -0.2991],
         [-0.5824, -0.4965, -0.1542,  1.1482],
         [ 0.5182,  0.5445,  1.1730, -0.2523]]])

and lengths = torch.tensor([1, 2])
do you want to have sth like this?
tensor([[[ 1.1937, -0.7235, -0.1802, -0.5610],
         [ 0.0000,  0.0000,  0.0000,  0.0000],
         [ 1.1573, -1.8952,  0.4175, -0.2085]],

        [[ 0.4069, -0.1069, -0.3838, -0.2991],
         [-0.5824, -0.4965, -0.1542,  1.1482],
         [ 0.0000,  0.0000,  0.0000,  0.0000]]])

or sth like this:
tensor([[[ 1.4429, -0.8365, -0.2565,  0.2319],
         [ 0.0000,  0.0000,  0.0000,  0.0000],
         [ 0.0000,  0.0000,  0.0000,  0.0000]],

        [[ 1.7247,  0.2831,  0.0687,  0.6557],
         [ 0.5110,  1.7607,  0.8107,  0.3624],
         [ 0.0000,  0.0000,  0.0000,  0.0000]]])

Thanks