Evaluation and training at every loop using the same variables

I have a network that trains for many iterations. At each iteration, I parse in a torch variable into my model. After the loss is computed, I would like to evaluate based on the same torch variable. How can I do this?

Is it by setting variable.volatile = False before the training step and variable.volatile = True after the training step and before the evaluation step?

1 Like

Yes, and also set your network in eval mode if you want certain modules to behave as they should be in test time.

1 Like

Thanks! :slight_smile: