Loss function for 2 Images

Hi,
I am want a loss function which will give me loss in terms of different image comparison methods such as SSD (sum of square differences).
Is there any predefined function for that??
Thank you in advance!!

You might use nn.MSELoss(reduction='sum').