I don’t know where you are stuck, but given that you want to calculate the loss as well as other metrics you could reuse the previously used training code, call model.eval() and skip the optimization of the model.