Solved by albanD in post #2 
              
              
                Hi, 
In your pytorch model, you already have access to both loss at every iteration and train_losses at the end of the epoch. 
So you don’t need a callback actually in pytorch. You can write a function with whatever you need directly.