I have a question about the method foward in LabelSmoothing. I debug it by Pycharm and the excuting order is from
loss = self.criterion(x.contiguous().view(-1, x.size(-1)), #[30, 9, 512] --> [270, 512]
y.contiguous().view(-1)) / norm #[30, 9] --> [270] (SimpleLossCompute's method call)
to
method forward in LabelSmoothing
def forward(self, x, target): #x is the output of model, target is label
assert x.size(1) == self.size
true_dist = x.data.clone()
....
why the dim of x changes from [270, 512] to [270, 11]
Thank you for a great piece.
I have a question about the method foward in LabelSmoothing. I debug it by Pycharm and the excuting order is from loss = self.criterion(x.contiguous().view(-1, x.size(-1)), #[30, 9, 512] --> [270, 512] y.contiguous().view(-1)) / norm #[30, 9] --> [270] (SimpleLossCompute's method call) to method forward in LabelSmoothing def forward(self, x, target): #x is the output of model, target is label assert x.size(1) == self.size true_dist = x.data.clone() .... why the dim of x changes from [270, 512] to [270, 11]