Thank you for your reply. I have a follow-up question:
For Embedding, there is a padding_idx argument. As I understand, the row of weights corresponding to the padding_idx is always zeroed, and never updated during backpropagation. This causes the padding vector to return an all-zero vector.
Is it possible to do something similar for the weights of a Linear module? Specifically, is there a way to define only a certain row of weights that is initialized to zero, and never update by backpropagation?