通过以下形式进行参数初始化 self.fc = nn.Linear(n_head * d_v, d_model) nn.init.xavier_normal_(self.fc.weight) 转载于:https://www.cnblogs.com/yeran/p/11197047.html