@@ -80,10 +80,7 @@ def _compute_metric(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
8080 """
8181
8282 if not x .shape == y .shape :
83- raise ValueError (
84- f"Input images should have the same dimensions, \
85- but got { x .shape } and { y .shape } ."
86- )
83+ raise ValueError (f"Input images should have the same dimensions, but got { x .shape } and { y .shape } ." )
8784
8885 for d in range (len (x .shape ) - 1 , 1 , - 1 ):
8986 x = x .squeeze (dim = d )
@@ -94,10 +91,7 @@ def _compute_metric(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
9491 elif len (x .shape ) == 5 :
9592 avg_pool = F .avg_pool3d
9693 else :
97- raise ValueError (
98- f"Input images should be 4-d or 5-d tensors, but \
99- got { x .shape } "
100- )
94+ raise ValueError (f"Input images should be 4-d or 5-d tensors, but got { x .shape } " )
10195
10296 if self .weights is None :
10397 # as per Ref 1 - Sec 3.2.
@@ -109,14 +103,14 @@ def _compute_metric(self, x: torch.Tensor, y: torch.Tensor) -> torch.Tensor:
109103 for idx , shape_size in enumerate (x .shape [2 :]):
110104 if shape_size % divisible_by != 0 :
111105 raise ValueError (
112- f"Image size needs to be divisible by { divisible_by } but \
113- dimension { idx + 2 } has size { shape_size } "
106+ f"Image size needs to be divisible by { divisible_by } but "
107+ f" dimension { idx + 2 } has size { shape_size } "
114108 )
115109
116110 if shape_size < bigger_than :
117111 raise ValueError (
118- f"Image size should be larger than { bigger_than } due to \
119- the { len (self .weights ) - 1 } downsamplings in MS-SSIM."
112+ f"Image size should be larger than { bigger_than } due to "
113+ f" the { len (self .weights ) - 1 } downsamplings in MS-SSIM."
120114 )
121115
122116 levels = self .weights .shape [0 ]
0 commit comments