`phase_` is set when `data_transformer` is constructed using the global `Caffe::phase()` state. https://github.com/BVLC/caffe/blob/master/include/caffe/data_transformer.hpp#L18 This is done when the test net is constructed in `InitTestNets`. https://github.com/BVLC/caffe/blob/master/src/caffe/solver.cpp#L153 `Caffe::phase()` is still `Caffe::TRAIN` at this point.