Thank you for your reply. I have solved this problem, but I still have a small problem to solve. I have two loss formulas that need to be coded with pytorch, but I have no clue now. Can you help me? Thank you very much