@@ -37,7 +37,7 @@ def fusion_gru(
37
37
h0 ,
38
38
wh ,
39
39
np .zeros (
40
- (1 , wh .shape [1 ]), dtype = 'float64 ' ),
40
+ (1 , wh .shape [1 ]), dtype = 'float32 ' ),
41
41
is_reverse ,
42
42
act_state ,
43
43
act_gate )
@@ -62,15 +62,15 @@ def setUp(self):
62
62
T = sum (self .lod [0 ])
63
63
N = len (self .lod [0 ])
64
64
65
- x = np .random .rand (T , self .M ).astype ('float64 ' )
66
- wx = np .random .rand (self .M , 3 * self .D ).astype ('float64 ' )
67
- wh = np .random .rand (self .D , 3 * self .D ).astype ('float64 ' )
65
+ x = np .random .rand (T , self .M ).astype ('float32 ' )
66
+ wx = np .random .rand (self .M , 3 * self .D ).astype ('float32 ' )
67
+ wh = np .random .rand (self .D , 3 * self .D ).astype ('float32 ' )
68
68
bias = np .random .rand (
69
- 1 , 3 * self .D ).astype ('float64 ' ) if self .with_bias else np .zeros (
70
- (1 , 3 * self .D ), dtype = 'float64 ' )
69
+ 1 , 3 * self .D ).astype ('float32 ' ) if self .with_bias else np .zeros (
70
+ (1 , 3 * self .D ), dtype = 'float32 ' )
71
71
h0 = np .random .rand (
72
- N , self .D ).astype ('float64 ' ) if self .with_h0 else np .zeros (
73
- (N , self .D ), dtype = 'float64 ' )
72
+ N , self .D ).astype ('float32 ' ) if self .with_h0 else np .zeros (
73
+ (N , self .D ), dtype = 'float32 ' )
74
74
75
75
_ , _ , _ , hidden = fusion_gru (
76
76
x , self .lod , h0 , wx , wh , bias , self .is_reverse ,
@@ -93,7 +93,9 @@ def setUp(self):
93
93
}
94
94
95
95
def test_check_output (self ):
96
- self .check_output (atol = 1e-8 )
96
+ for use_seq in {True , False }:
97
+ self .attrs ['use_seq' ] = use_seq
98
+ self .check_output ()
97
99
98
100
99
101
class TestFusionGRUOpNoInitial (TestFusionGRUOp ):
0 commit comments