ZCA whitening in PyTorch

Is there any available implementation of whitening data with ZCA using torchvision transform?

I may try to implement it, but a problem would be saving the mean and the components computed for the training set and reusing them for the test set. The only way I see is using an up-value, maybe some of you have a better idea?