To be clear, when you say “easiest way to make a custom RNN compatible with variable-length sequences is to do what this repo does” do you mean this part of the code 250, where he multiplies any output outside of the time-limit (time < length) by zero? I’ve copied the relevant bit of code below:
    mask = (time < length).float().unsqueeze(1).expand_as(h_next)
    h_next = h_next*mask + hx[0]*(1 - mask)
    c_next = c_next*mask + hx[1]*(1 - mask)