I tried to cut the connections between each time step.
I change this
    input_batch = torch.cat([input_batch[:, :, 1:], output_batch[:, :, -1], dim=2)

to
    input_batch = Variable(torch.cat([input_batch[:, :, 1:].data, output_batch[:, :, -1].data, dim=2))

but got same result. I’m a little confused, because I recreate the input_batch, the intermediary should not exist. Later, I think it is not about the intermediary result, but the compiler doesn’t know the relation between each time step and just create instance for each time step, which wastes so much memory. Since the compiler is not so smart yet, is there any way to tell it explicitly that I only need to create one instance here?