@@ -799,7 +799,9 @@ def test_relu(self):
799
799
800
800
@skip_caffe2_backend ("fails on caffe2 with dim issue" )
801
801
@check_onnxruntime_incompatibility ("Mul" )
802
+ @check_tf_min_version ("1.6" )
802
803
def test_leaky_relu (self ):
804
+ # starting from tf 1.6, leaky_relu supports `feature` x of int type
803
805
x_types = [np .float32 , np .int32 , np .int64 ]
804
806
for x_type in x_types :
805
807
x_val = 1000 * np .random .random_sample ([1000 , 100 ]).astype (x_type )
@@ -810,6 +812,19 @@ def test_leaky_relu(self):
810
812
self ._run_test_case ([_OUTPUT ], {_INPUT : x_val })
811
813
tf .reset_default_graph ()
812
814
815
+ @skip_caffe2_backend ("fails on caffe2 with dim issue" )
816
+ @check_onnxruntime_incompatibility ("Mul" )
817
+ @check_tf_max_version ("1.5" )
818
+ def test_leaky_relu_old (self ):
819
+ # for tf_version <= 1.5, leaky_relu requires `feature` x to be of type `float32`
820
+ x_val = 1000 * np .random .random_sample ([1000 , 100 ]).astype (np .float32 )
821
+ for alpha in [0.1 , - 0.1 , 1.0 , - 1.0 ]:
822
+ x = tf .placeholder (x_val .dtype , [None ] * x_val .ndim , name = _TFINPUT )
823
+ x_ = tf .nn .leaky_relu (x , alpha )
824
+ _ = tf .identity (x_ , name = _TFOUTPUT )
825
+ self ._run_test_case ([_OUTPUT ], {_INPUT : x_val })
826
+ tf .reset_default_graph ()
827
+
813
828
@check_onnxruntime_incompatibility ("Elu" )
814
829
def test_elu (self ):
815
830
x_val = np .array ([0.5 , 1.0 , - 0.5 , - 1.0 ], dtype = np .float32 ).reshape ((2 , 2 ))
0 commit comments