Access gates of lstm cell

I am writing a program, and I am trying to implement DeepMind’s RowLSTM function from their Pixel RNN paper. The authors explicitly define how to do a convolution which determines the values of the four gates of an LSTM cell. How would one implement this in PyTorch (specifically setting the values of the gates of the LSTM cell). From what I understand, each row of the image should become an LSTM cell, and the next row’s LSTM cell is computed using a 1x3 convolution of the hidden states of the previous row. So, a lot of accessing of the LSTM gates is necessary. How does one do this? Thank you in advance for any help, it is much appreciated.