Thank you for your nice information. Oh then, after update parameters, just reset the embedding weight of specific index. Is it the same as yours? It looks much simpler.
 optimizer.zero_grad()
 loss.backward()
 optimizer.step()
 
 model.embd.weight.data[specific_index] = 0