How to write a dynamically unrolled RNN with GLUON

Gluon’s LSTM layer should be to unroll all the samples in a batch to the T dimension of the matrix of the batch, but the problem is that many samples in a batch may be Pad to the T dimension, so how to get each sample to unroll to itself The PAD position is no longer calculated? Just like tf.nn.dynamic_rnn() in Tensorflow can be controlled by passing in the length of each sample. What should I do in Gluon? Please help me.

As per my knowledge dynamic unrolling is not supported yet. You can however, set fixed sequence lengths (buckets) and fully unroll for that T. Here is an example https://github.com/apache/incubator-mxnet/blob/master/example/rnn/bucketing/lstm_bucketing.py
https://mxnet.incubator.apache.org/faq/bucketing.html