Hi,
I am a new to pytorch.
I was searching for some solutions on forum and somebody mentioned that I have to do " model.eval() " for both validation and testing phase, when I have batchnorm and dropout layers in my model definition. So, can somebody clarify this in a little detail, how and why to do this?.
Here is how my code roughly looks like:
Should I add model.eval() before computing outputsD via forward pass in validation phase.
Note that I am not reloading model just doing a forward pass after training model over all batches of data.
#code
model = Built_CNN(input_size, classes)
epochs Loop until maxiter
#Training Loop over dataset:
inputs = Variable(data)
optimizer.zero_grad()
outputs = model(inputs)
…
…
…
#Valdiation Loop over dataset:
inputsD = Variable(dataD, volatile=True)
outputsD = model(inputsD)
…
…