self.rnn was defined at image_encoder.py init
def __init__(self, num_layers, bidirectional, rnn_size, dropout,
             image_chanel_size=3):
    super(ImageEncoder, self).__init__()
    self.num_layers = num_layers
    self.num_directions = 2 if bidirectional else 1
    self.hidden_size = rnn_size

    self.layer1 = nn.Conv2d(image_chanel_size, 64, kernel_size=(3, 3),
                            padding=(1, 1), stride=(1, 1))
    self.layer2 = nn.Conv2d(64, 128, kernel_size=(3, 3),
                            padding=(1, 1), stride=(1, 1))
    self.layer3 = nn.Conv2d(128, 256, kernel_size=(3, 3),
                            padding=(1, 1), stride=(1, 1))
    self.layer4 = nn.Conv2d(256, 256, kernel_size=(3, 3),
                            padding=(1, 1), stride=(1, 1))
    self.layer5 = nn.Conv2d(256, 512, kernel_size=(3, 3),
                            padding=(1, 1), stride=(1, 1))
    self.layer6 = nn.Conv2d(512, 512, kernel_size=(3, 3),
                            padding=(0, 0), stride=(1, 1))

    self.batch_norm1 = nn.BatchNorm2d(256)
    self.batch_norm2 = nn.BatchNorm2d(512)
    self.batch_norm3 = nn.BatchNorm2d(512)

    src_size = 512
    dropout = dropout[0] if type(dropout) is list else dropout
    self.rnn = nn.LSTM(src_size, int(rnn_size / self.num_directions),
                       num_layers=num_layers,
                       dropout=dropout,
                       bidirectional=bidirectional)
    self.pos_lut = nn.Embedding(1000, src_size)