mMagmer:

if you place any number greater than 56 in lengths of each batch element, it raises an error.


i think you’re not suppose to have any length greater than original sequence.
57 -->55
import torch
import torch.nn as nn

total = 256 * 56 * 4 
x = torch.arange(0, total).view(256,56 , 4).float()
x.requires_grad = True
o= nn.utils.rnn.pack_padded_sequence(x, torch.tensor(256*[55]), batch_first=True)
o[0].mean().backward()