import tensorflow as tf

    """
    if pad is None:
        pad = tf.expand_dims(tf.zeros_like(vecs[0]), 0)
    else:
        pad = tf.expand_dims(pad, 0)
    vecs_padded = tf.concat(0, [vecs, pad])
    # flatten mask and edges
    vecs_gathered = tf.gather(vecs_padded, mask_inds)
