The valid loss is calculated after calling the model.eval() everytime. After the calculation, the parameters are saved. In theorectical view, by loading these parameters to calculate valid loss in model.eval, there should not be a big gap of losses…