Hi, If I understand correctly want you want to do, you could do this:
sentence_embedding = torch.Tensor(11, 20)

# We the equivalent indices instead of flags
# sentence_split_flag = torch.LongTensor([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]) 
# which you can also get with:
# sentence_split_idx = (sentence_split_flag == 1).nonzero().view(-1)
sentence_split_idx =  torch.LongTensor([0, 5])

pooled_sentence_embedding  = sentence_embedding.index_select(dim=0, index=sentence_split_idx)