Bidirectional LSTM Seq2Seq with Residual connections in decoder

I am trying to build a seq2seq model including bidirectional LSTMs in both encoder and decoder parts. I also want to add residual connections to the decoder part, i.e., to add the input of each LSTMCell to its output. Can anyone tell me how to change the outputs of LSTMCells in the decoder when I’m using the torch.nn.LSTM command in Pytorch? Enclosed you can see a figure of what I want to implement regarding the decoder part. (Assume my model includes 1 layer with 512 cells)