@@ -174,7 +174,12 @@ class TestGlobalMutualInformationLossBSpline(unittest.TestCase):
174174
175175 @parameterized .expand (["prediction" , "target" ])
176176 def test_b_spline_single_constant_input_is_finite (self , constant_input ):
177- """Verify either independently constant input yields finite gradients."""
177+ """Verify either independently constant input yields finite gradients.
178+
179+ Args:
180+ constant_input: Which input (``"prediction"`` or ``"target"``)
181+ is held constant.
182+ """
178183 varying = torch .linspace (0.0 , 1.0 , 64 ).reshape (1 , 1 , 8 , 8 )
179184 if constant_input == "prediction" :
180185 pred = torch .zeros_like (varying , requires_grad = True )
@@ -213,8 +218,14 @@ def test_b_spline_constant_half_precision_images_are_finite(self):
213218 ("float16_large" , torch .float16 , 65000.0 ),
214219 ]
215220 )
216- def test_b_spline_nonzero_ranges_are_finite (self , _ , dtype , maximum ):
217- """Verify extreme nonzero ranges yield finite loss and gradients."""
221+ def test_b_spline_nonzero_ranges_are_finite (self , case_name , dtype , maximum ):
222+ """Verify extreme nonzero ranges yield finite loss and gradients.
223+
224+ Args:
225+ case_name: Descriptive label for the parameterized range case.
226+ dtype: Tensor dtype used for the prediction and target.
227+ maximum: Nonzero upper endpoint of the tested intensity range.
228+ """
218229 values = torch .tensor ([0.0 , maximum , maximum , 0.0 ], dtype = dtype ).reshape (1 , 1 , 2 , 2 )
219230 pred = values .clone ().requires_grad_ ()
220231 target = torch .flip (values , dims = (- 1 ,))
0 commit comments