You should create an object of SSIM and call it afterwards via:
criterion = SSIM()
loss = criterion(output, target)

If you are using only PyTorch methods in the forward method, you don’t need to define the backward manually and Autograd will create it for you.
PS: you can post code snippets by wrapping them into three backticks ```, which makes debugging easier.