https://github.com/VainF/pytorch-msssim/blob/d23a69e869df30fefde0773869be90745a078711/pytorch_msssim/ssim.py#L135 https://github.com/VainF/pytorch-msssim/blob/d23a69e869df30fefde0773869be90745a078711/pytorch_msssim/ssim.py#L183 I think it's not necessary to judge if X.type() == Y.type(), or mixed precision training will not be supported.