Define Transformer Losses Formula