(lengths_b, max_length)
return mask_bt
Turns a vector of lengths into a boolean mask

    Args:
        lengths_b: an integer vector of lengths
        max_length: maximum length to fill the mask

    Returns:
        a boolean array of shape (batch_size, max_length)
        row[i] consists of True repeated lengths_b[i] times, followed by False
Turns a vector of lengths into a boolean mask
Turns a vector of lengths into a boolean mask
def lengths_to_mask(lengths_b, max_length):
    """
    Turns a vector of lengths into a boolean mask

    Args:
        lengths_b: an integer vector of lengths
        max_length: maximum length to fill the mask

    Returns:
        a boolean array of shape (batch_size, max_length)
        row[i] consists of True repeated lengths_b[i] times, followed by False
    """
    lengths_b = tf.convert_to_tensor(lengths_b)
    assert lengths_b.get_shape().ndims == 1
    mask_bt = tf.expand_dims(tf.range(max_length), 0) < tf.expand_dims(lengths_b, 1)
    return mask_bt
def lengths_to_mask ( lengths_b , max_length ) : lengths_b = tf . convert_to_tensor ( lengths_b ) assert lengths_b . get_shape ( ) . ndims == 1 mask_bt = tf . expand_dims ( tf . range ( max_length ) , 0 ) < tf . expand_dims ( lengths_b , 1 ) return mask_bt