jorge-pessoa / pytorch-msssim

PyTorch differentiable Multi-Scale Structural Similarity (MS-SSIM) loss
Other
454 stars 70 forks source link

functools.lru_cache can be used for saving the window #8

Closed Yash-5 closed 4 years ago

Yash-5 commented 5 years ago

There is a todo in the code # TODO: store window between calls if possible

An easy way to do this is to wrap create_window with the functools.lru_cache wrapper.

https://docs.python.org/3/library/functools.html

jorge-pessoa commented 4 years ago

Thank you for your suggestion, I will be integrating this and testing locally to assess the performance difference. Feel free to test it from your side using the branch feature/lru_cache. If a significant difference is present I will merge the changes to master