For image sampling, 500 samples are generated every time to recompute the batch normalization statistics over the sampled images. This code here saves the recomputed statistics for the first time the code is run and then loads the statistics whenever sampling is run next. Thus the redundant 500 samples are not computed every time, and then sampling can be done fast.
For image sampling, 500 samples are generated every time to recompute the batch normalization statistics over the sampled images. This code here saves the recomputed statistics for the first time the code is run and then loads the statistics whenever sampling is run next. Thus the redundant 500 samples are not computed every time, and then sampling can be done fast.