For the loss, the padding index of 0 should prevent calculating the wrong loss by including the padded elements. However for training/validation accuracy we must make sure that our method only uses the values for non-padded inputs (in the outputs, we do not have an actual padding index since index 0 actually represents some class).
For the loss, the padding index of 0 should prevent calculating the wrong loss by including the padded elements. However for training/validation accuracy we must make sure that our method only uses the values for non-padded inputs (in the outputs, we do not have an actual padding index since index 0 actually represents some class).