Autograd in the case of BPTT

Hello, switched to Pytorch recently because writing everything from scratch is quite painful.
I’m mainly using the library for the autograd feature since its saving a lot of time and efforts.

I implemented different MLP without problem so far so I decided to give a try to RNN.

I didn’t find in the documentation how the autograd feature is used for backpropagation through time. Is there a similar feature for this task ?

I’m working on a stacked GRU but I’m not using the inbuilt GRU cell since I like having more control over my network.

How do you actually perform BPTT for stacked GRU/LSTM using the autograd feature ?

Thank you.

BPTT isn’t anything more special than an ordinary computation graph. You can think of as unrolled if that makes it easier to understand.

You can use nn.GRU and nn.LSTM directly, and autograd will work just fine.