'How right use SSIM loss pytorch?

I don't understand how I can use this loss in my model. I saw official topic but it don't help me. Maybe I need to describe formulas from there. I have SegNet model

SSIM from github



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source