Using apply is the recommended approach as setting the whole network to train mode will modify the statistics of any batch normalization layers you have in the network. Thanks for showing how to do it with that method!