def get_by_index(x, idx):
    assert (len(x.get_shape()) == 2)
    assert (len(idx.get_shape()) == 1)
    idx_flattened = ((tf.range(0, x.shape[0]) * x.shape[1]) + idx)
    y = tf.gather(tf.reshape(x, [(- 1)]), idx_flattened)
    return y
def get_by_index(x, idx):
    assert (len(x.get_shape()) == 2)
    assert (len(idx.get_shape()) == 1)
    idx_flattened = ((tf.range(0, x.shape[0]) * x.shape[1]) + idx)
    y = tf.gather(tf.reshape(x, [(- 1)]), idx_flattened)
    return y