I believe this length calculation function in 11_char_rnn.py is wrong. Since the seq in the above line is the one-hot version of seq, so even for the padded 0, tf.reduce_max(tf.sign(seq), 2) will get a value of 1 instead of 0. So it will always return the num_steps. Instead, tf.reduce_sum(tf.sign(self.seq), 1) will get the right unpadded length. Note self.seq here is NOT the one-hot version of sequence.
length = tf.reduce_sum(tf.reduce_max(tf.sign(seq), 2), 1)
I believe this length calculation function in 11_char_rnn.py is wrong. Since the seq in the above line is the one-hot version of seq, so even for the padded 0, tf.reduce_max(tf.sign(seq), 2) will get a value of 1 instead of 0. So it will always return the num_steps. Instead, tf.reduce_sum(tf.sign(self.seq), 1) will get the right unpadded length. Note self.seq here is NOT the one-hot version of sequence.