hi guys i wanna write a function
It should print the loss and the test set accuracy , and should return
y_pred as NumPy arrays.
so i tried the following :
def test_model(model_ft, test_dataloaders,criterion,device):
# set model to evaluate model model_ft.eval() # Iterate over data. for inputs, labels in dataloaders[phase]: inputs = inputs.to(device) labels = labels.to(device)
and now my question how do i get y_pred and y_true and the rest things?
We are in the framework of transfer learning in pytorch so the function i wanna write is the same as the train_model see(https://pytorch.org/tutorials/beginner/transfer_learning_tutorial.html) but somewhat edited for the prediction purpose. I also thought of concatenate the y_pred and y_true after each batch but i really cant put this into reality could you plz help me out ? Thanks