Thanks:
def forward(self, x):
    print('x shape',x.shape)
    out, _ = self.rnn(x)
    print('before reshape',out.shape)
    out =out[:, -1, :]
    print('after reshape',out.shape)
    out = self.out(out)
    print('output shape',out.shape)
    return out

and the result is:
x shape torch.Size([2227, 1, 14])
before reshape torch.Size([2227, 1, 40])
after reshape torch.Size([2227, 40])
output shape torch.Size([2227, 1])