<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def length(self, rows=None):
 """Tensor holding the current length of episodes. Args: rows: Episodes to select length from, defaults to all. Returns: Batch tensor of sequence lengths. """

    rows = tf.range(self._capacity) if rows is None else rows
    return tf.gather(self._length, rows)