@@ -124,10 +124,8 @@ def __init__(
124124 aspect_ratios = (aspect_ratios ,) * len (self .sizes )
125125
126126 if len (self .sizes ) != len (aspect_ratios ):
127- raise ValueError (
128- "len(sizes) and len(aspect_ratios) should be equal. \
129- It represents the number of feature maps."
130- )
127+ raise ValueError ("len(sizes) and len(aspect_ratios) should be equal. \
128+ It represents the number of feature maps." )
131129
132130 spatial_dims = len (ensure_tuple (aspect_ratios [0 ][0 ])) + 1
133131 spatial_dims = look_up_option (spatial_dims , [2 , 3 ])
@@ -172,16 +170,12 @@ def generate_anchors(
172170 scales_t = torch .as_tensor (scales , dtype = dtype , device = device ) # sized (N,)
173171 aspect_ratios_t = torch .as_tensor (aspect_ratios , dtype = dtype , device = device ) # sized (M,) or (M,2)
174172 if (self .spatial_dims >= 3 ) and (len (aspect_ratios_t .shape ) != 2 ):
175- raise ValueError (
176- f"In { self .spatial_dims } -D image, aspect_ratios for each level should be \
177- { len (aspect_ratios_t .shape ) - 1 } -D. But got aspect_ratios with shape { aspect_ratios_t .shape } ."
178- )
173+ raise ValueError (f"In { self .spatial_dims } -D image, aspect_ratios for each level should be \
174+ { len (aspect_ratios_t .shape ) - 1 } -D. But got aspect_ratios with shape { aspect_ratios_t .shape } ." )
179175
180176 if (self .spatial_dims >= 3 ) and (aspect_ratios_t .shape [1 ] != self .spatial_dims - 1 ):
181- raise ValueError (
182- f"In { self .spatial_dims } -D image, aspect_ratios for each level should has \
183- shape (_,{ self .spatial_dims - 1 } ). But got aspect_ratios with shape { aspect_ratios_t .shape } ."
184- )
177+ raise ValueError (f"In { self .spatial_dims } -D image, aspect_ratios for each level should has \
178+ shape (_,{ self .spatial_dims - 1 } ). But got aspect_ratios with shape { aspect_ratios_t .shape } ." )
185179
186180 # if 2d, w:h = 1:aspect_ratios
187181 if self .spatial_dims == 2 :
0 commit comments