Hi,
In this 1 line in the.word_language_model example, the validation loss is multiplied by len(data)
            total_loss += len(data) * criterion(output, targets).item()
    return total_loss / (len(data_source) - 1)

Two questions,

Why is the loss multiplied by the len(data) i.e. the number of tokens in the batch? Especially considering that the training loss is not multiplied by this factor
Why is the total_loss eventually divided by len(data_source) - 1 and not just len(data_source)? Why is -1 necessary here since we aim to get the # of batches in total?

Any help will be greatly appreciated. And thanks for these examples in the first place - really have made the transition to pytorch smoother.
Best,