For the TextEncoder:
hidden_size=512, embed_size=256, vocab_size=28, rnn_type='GRU', num_convs=0.
For the input x, its shape is bs X seq_len, where the seq_len is adapted to the max_len in a batch. And according to my statistics, seq_len ranges in [25, 35].
Hope these infomation can help you locate the problem. Much thanks.