def test_ssim_lowerbound(self):
    """Test the unusual corner case where SSIM is -1."""
    sz = 11
    img = np.meshgrid(*([np.linspace(-1, 1, sz)] * 2))[0][None, ..., None]
    eps = 1e-5
    ssim = math.compute_ssim(
        img, -img, 1., filter_size=sz, filter_sigma=1.5, k1=eps, k2=eps)
    self.assertAllClose(ssim, -np.ones_like(ssim))
Test the unusual corner case where SSIM is -1.
internal/math_test.py