Personally, I think it’s most efficient to do the reindexing beforehand similar to
NUM_WORDS = 1000
is_fixed = torch.bernoulli(torch.full((NUM_WORDS,),0.5)) # dummy
fixed_to_original = [i for i in range(NUM_WORDS) if is_fixed[i]]
num_fixed = len(fixed_to_original)
trained_to_original = [i for i in range(NUM_WORDS) if not is_fixed[i]]
sorted_to_original = fixed_to_original + trained_to_original
original_to_sorted = {orig: new for new, orig in enumerate(sorted_to_original)}

but if you want to use an arbitrary mask and recreate that for every batch you feed by looking up whether input words are fixed-vector ones, that’s not too hard either.
Best regards
Thomas