1919 TEST_WITH_ROCM , _assertGradAndGradgradChecks
2020from torch .testing ._internal .common_cuda import TEST_CUDA
2121from torch .testing ._internal .common_device_type import expectedAlertNondeterministic
22- from torch .autograd .gradcheck import get_numerical_jacobian , iter_tensors
22+ from torch .autograd .gradcheck import get_numerical_jacobian , iter_tensors , \
23+ gradcheck , gradgradcheck
2324from torch .autograd import Variable
2425import torch .backends .cudnn
2526
@@ -4372,6 +4373,7 @@ def padding3d_circular(input, pad):
43724373 reference_fn = lambda i , t , il , tl , m :
43734374 ctcloss_reference (i , t , il , tl , blank = 14 , reduction = get_reduction (m )),
43744375 desc = 'lengths_intlists' ,
4376+ check_forward_only = True ,
43754377 check_sum_reduction = True ,
43764378 check_gradgrad = False ,
43774379 check_half = False ,
@@ -4402,6 +4404,7 @@ def padding3d_circular(input, pad):
44024404 reference_fn = lambda i , t , il , tl , m :
44034405 ctcloss_reference (i , t , il , tl , blank = 14 , reduction = get_reduction (m )),
44044406 desc = 'lengths_tensors' ,
4407+ check_forward_only = True ,
44054408 check_sum_reduction = True ,
44064409 check_gradgrad = False ,
44074410 check_half = False ,
@@ -4430,6 +4433,7 @@ def padding3d_circular(input, pad):
44304433 target_fn = lambda : torch .randint (1 , 15 , (3 , 30 ), dtype = torch .int ),
44314434 reference_fn = lambda i , t , il , tl , m :
44324435 ctcloss_reference (i , t , il , tl , blank = 0 , reduction = get_reduction (m )),
4436+ check_forward_only = True ,
44334437 check_sum_reduction = True ,
44344438 check_gradgrad = False ,
44354439 check_half = False ,
@@ -4447,6 +4451,7 @@ def padding3d_circular(input, pad):
44474451 target_fn = lambda : torch .randint (1 , 15 , (3 , 30 ), dtype = torch .int ),
44484452 reference_fn = lambda i , t , il , tl , m :
44494453 ctcloss_reference (i , t , il , tl , blank = 0 , reduction = get_reduction (m )),
4454+ check_forward_only = True ,
44504455 check_sum_reduction = True ,
44514456 check_gradgrad = False ,
44524457 check_half = False ,
@@ -4462,6 +4467,7 @@ def padding3d_circular(input, pad):
44624467 target_fn = lambda : torch .randint (1 , 15 , (3 , 30 ), dtype = torch .int ),
44634468 reference_fn = lambda i , t , il , tl , m :
44644469 ctcloss_reference (i , t , il , tl , blank = 0 , reduction = get_reduction (m )),
4470+ check_forward_only = True ,
44654471 check_sum_reduction = True ,
44664472 check_gradgrad = False ,
44674473 check_half = False ,
@@ -4861,7 +4867,7 @@ class CriterionTest(TestBase):
48614867 def __init__ (self , * args , ** kwargs ):
48624868 super ().__init__ (* args , ** kwargs )
48634869 self .should_test_cuda = kwargs .get ('test_cuda' , True )
4864- self .check_forward_only = kwargs .get ('check_forward_only' , True )
4870+ self .check_forward_only = kwargs .get ('check_forward_only' , False )
48654871
48664872 def _get_target (self ):
48674873 return self ._get_arg ('target' , True )
0 commit comments