Problem is not very well explained, as far as i understood you are validating a dataset and get out of memory. Keep in mind that while training, when you use model.backwards() memory get clean. If you are validating you are not cleaning the memory. Could it be?