@@ -2576,10 +2576,14 @@ def testFCLayerFProp(self):
25762576 @parameterized .named_parameters (
25772577 ('F32FPropF32Input' , tf .float32 , tf .float32 , 0.668211 ),
25782578 ('F32FPropBF16Input' , tf .float32 , tf .bfloat16 , 0.669565 ),
2579- ('BF16FPropF32Input' , tf .bfloat16 , tf .float32 , 0.667969 ),
2580- ('BF16FPropBF16Input' , tf .bfloat16 , tf .bfloat16 , 0.667969 ),
2579+ ('BF16FPropF32Input' , tf .bfloat16 , tf .float32 , 0.667969 , 1e-2 ),
2580+ ('BF16FPropBF16Input' , tf .bfloat16 , tf .bfloat16 , 0.667969 , 1e-2 ),
25812581 )
2582- def testFCLayerDtypes (self , fprop_dtype , input_dtype , expected_sum = 0. ):
2582+ def testFCLayerDtypes (self ,
2583+ fprop_dtype ,
2584+ input_dtype ,
2585+ expected_sum = 0. ,
2586+ tol = 1e-6 ):
25832587 with self .session (use_gpu = True ):
25842588 tf .random .set_seed (398847392 )
25852589 np .random .seed (12345 )
@@ -2597,7 +2601,11 @@ def testFCLayerDtypes(self, fprop_dtype, input_dtype, expected_sum=0.):
25972601
25982602 output = proj_layer .FPropDefaultTheta (inputs )
25992603 self .evaluate (tf .global_variables_initializer ())
2600- self .assertAllClose (expected_sum , self .evaluate (tf .reduce_sum (output )))
2604+ self .assertAllClose (
2605+ expected_sum ,
2606+ self .evaluate (tf .reduce_sum (output )),
2607+ atol = tol ,
2608+ rtol = tol )
26012609
26022610 def testFCLayerBackProp (self ):
26032611 with self .session (use_gpu = True ) as sess :
0 commit comments