I loaded the pre-trained glove embedding in nn.Embedding, set the Embedding untrainable, and I want to make just one embedding trainable, like the <unk> embedding. I tried the below code (the <unk>'s index is 1):
import torch.nn as nn

word_embedding = nn.Embedding(5, 2)]

word_embedding.weight.requires_grad = False
word_embedding.weight[1].requires_grad = True

print(word_embedding.weight[1].requires_grad)

The output is False, what’s the solution about this?