# Monte Carlo Dropout as Uncertainty predection

I am pretty new to Python and this board so I am not sure, if I am at the right place for my question since it doesn't include any code. If not so, please give my a hint for a better way/place to ask.

I am struggling with using Monte Carlo Dropouts for determine Uncertainty for my image classificator using ResNet18.

I know already to use dropout like

def dropout2d(input, p=0.5, training=True, inplace=False):


multiply times for getting a variance which can be interpreted as the uncertainty. I am pretty sure, that I already understood how MC-Dropout works in general.

So coming to my questions:

Do I use MC-dropout while training or testing and why? I feel like I have read different ways.

I have searched for a coding example from the dropouts but didn't find anything. Do you know Paper/ example code/ searchlink for a proper code?

Is

nn.dropout2d(imput, p=x, ...) the right way to use dropout for a image classificator?