Hello, thanks for your kind explanation, I now learn the difference between nn.Embedding and nn.Linear，But I cannot find the implementation of BP from the pytorch code, /home/linux/miniconda3/lib/python3.7/site-packages/torch/nn/modules/sparse.py.
I find the F.embedding function in /home/linux/miniconda3/lib/python3.7/site-packages/torch/nn/functional.pyi,  which only a function defination:
def embedding(
    input: Tensor, weight: Tensor, padding_idx: Optional[int] = ...,
    max_norm: Optional[float] = ..., norm_type: float = ...,
    scale_grad_by_freq: bool = ..., sparse: bool = ...) -> Tensor: ...