Dropout while testing

Hey everyone !
I was wondering if there was a way I could introduce dropout into a network while using it for inference.
I do not have access to the network definition which may or may not have a dropout layer.

How are you loading the model, if you don’t have the model definition?
Even if the model was completely stored (instead of its state_dict), you would have to have the source files, no?
If you are using a scripted model, then you should at least be able to see all modules.

Anyway, you if you don’t have access to the model and cannot check its layers, you could call model.train() before using the test method. This would however also set all batchnorm layers to trianing mode, which is usually wrong.

If you have access to the modules, you could call train() on the dropout layers only.