@lima @ptrblck
As I said earlier if you read my comment.
You passed the model into the train function and trained it without returning the it after training.
So the model you passed into the test function is not a trained model but rather a model that is yet to be trained.
The training and weight updates only happened in the train function, so if u call the model any other place, it won’t have those trained weights and It’ll still be the untrained model it is…simply because you passed the model as a parameter to the train function and made the trained model peculiar to just the train function.
So you either make the model global and make the train and test function to access and use it
Or
You either return the trained model after you trained it in the train function and assign it’s call to a variable for inference
Or
You save the already trained model and load it when you want to make inference.