@@ -300,9 +300,10 @@ def test_class_gradient_none_2(self):
300300
301301 def test_class_gradient_int_1 (self ):
302302 grad_predicted = self .classifier .class_gradient (self .x_test_iris [0 :1 ], label = 1 )
303- grad_expected = [[[- 0.56322294 , - 0.70427608 , - 0.98874801 , - 0.67053026 ]]]
303+ grad_expected = [[[- 0.56322294 , - 0.70493763 , - 0.98874801 , - 0.67053026 ]]]
304304
305305 for i_shape in range (4 ):
306+ print (grad_predicted [0 , 0 , i_shape ])
306307 self .assertAlmostEqual (grad_predicted [0 , 0 , i_shape ], grad_expected [0 ][0 ][i_shape ], 3 )
307308
308309 def test_class_gradient_int_2 (self ):
@@ -311,13 +312,16 @@ def test_class_gradient_int_2(self):
311312 [[- 0.56322294 , - 0.70427608 , - 0.98874801 , - 0.67053026 ]],
312313 [[- 0.50528532 , - 0.71700042 , - 0.82467848 , - 0.59614766 ]],
313314 ]
315+ print ("grad_predicted" )
316+ print (grad_predicted )
314317 np .testing .assert_array_almost_equal (grad_predicted , grad_expected , decimal = 4 )
315318
316319 def test_class_gradient_list_1 (self ):
317320 grad_predicted = self .classifier .class_gradient (self .x_test_iris [0 :1 ], label = [1 ])
318321 grad_expected = [[[- 0.56322294 , - 0.70427608 , - 0.98874801 , - 0.67053026 ]]]
319322
320323 for i_shape in range (4 ):
324+ print (grad_predicted [0 , 0 , i_shape ])
321325 self .assertAlmostEqual (grad_predicted [0 , 0 , i_shape ], grad_expected [0 ][0 ][i_shape ], 3 )
322326
323327 def test_class_gradient_list_2 (self ):
@@ -326,6 +330,8 @@ def test_class_gradient_list_2(self):
326330 [[- 0.56322294 , - 0.70427608 , - 0.98874801 , - 0.67053026 ]],
327331 [[0.70875132 , 0.25104877 , 1.70929277 , 0.88410652 ]],
328332 ]
333+ print ("grad_predicted" )
334+ print (grad_predicted )
329335 np .testing .assert_array_almost_equal (grad_predicted , grad_expected , decimal = 4 )
330336
331337 def test_class_gradient_label_wrong_type (self ):
@@ -340,6 +346,8 @@ def test_class_gradient_label_wrong_type(self):
340346 def test_loss_gradient (self ):
341347 grad_predicted = self .classifier .loss_gradient (self .x_test_iris [0 :1 ], self .y_test_iris [0 :1 ])
342348 grad_expected = np .asarray ([[- 0.21693791 , - 0.08792436 , - 0.51507443 , - 0.26990796 ]])
349+ print ("grad_predicted" )
350+ print (grad_predicted )
343351 np .testing .assert_array_almost_equal (grad_predicted , grad_expected , decimal = 4 )
344352
345353 def test_save (self ):
0 commit comments