@@ -3582,29 +3582,29 @@ def func(x):
3582
3582
self ._run_test_case (func , [_OUTPUT ], {_INPUT : input_val })
3583
3583
3584
3584
def test_reduce_all (self ):
3585
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3585
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3586
3586
def func (x ):
3587
3587
res = tf .reduce_all (input_tensor = x , keepdims = False )
3588
3588
res1 = tf .reduce_all (input_tensor = x , axis = [0 ], keepdims = False )
3589
3589
return tf .identity (res , name = _TFOUTPUT ), tf .identity (res1 , name = _TFOUTPUT1 )
3590
3590
self ._run_test_case (func , [_OUTPUT , _OUTPUT1 ], {_INPUT : input_val })
3591
3591
3592
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3592
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3593
3593
def func (input_x ):
3594
3594
res = tf .reduce_all (input_tensor = input_x , keepdims = True )
3595
3595
res1 = tf .reduce_all (input_tensor = input_x , axis = [0 ], keepdims = True )
3596
3596
return tf .identity (res , name = _TFOUTPUT ), tf .identity (res1 , name = _TFOUTPUT1 )
3597
3597
self ._run_test_case (func , [_OUTPUT , _OUTPUT1 ], {_INPUT : input_val })
3598
3598
3599
3599
def test_reduce_any (self ):
3600
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3600
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3601
3601
def func (x ):
3602
3602
res = tf .reduce_any (input_tensor = x , keepdims = False )
3603
3603
res1 = tf .reduce_any (input_tensor = x , axis = [0 ], keepdims = False )
3604
3604
return tf .identity (res , name = _TFOUTPUT ), tf .identity (res1 , name = _TFOUTPUT1 )
3605
3605
self ._run_test_case (func , [_OUTPUT , _OUTPUT1 ], {_INPUT : input_val })
3606
3606
3607
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3607
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3608
3608
def func (x ):
3609
3609
res = tf .reduce_any (input_tensor = x , keepdims = True )
3610
3610
res1 = tf .reduce_any (input_tensor = x , axis = [0 ], keepdims = True )
@@ -3613,14 +3613,14 @@ def func(x):
3613
3613
3614
3614
@check_opset_min_version (11 , "ReduceMin" )
3615
3615
def test_reduce_all_negative_axis (self ):
3616
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3616
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3617
3617
def func (x ):
3618
3618
res = tf .reduce_all (input_tensor = x , keepdims = False )
3619
3619
res1 = tf .reduce_all (input_tensor = x , axis = [- 1 ], keepdims = False )
3620
3620
return tf .identity (res , name = _TFOUTPUT ), tf .identity (res1 , name = _TFOUTPUT1 )
3621
3621
self ._run_test_case (func , [_OUTPUT , _OUTPUT1 ], {_INPUT : input_val })
3622
3622
3623
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3623
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3624
3624
def func (input_x ):
3625
3625
res = tf .reduce_all (input_tensor = input_x , keepdims = True )
3626
3626
res1 = tf .reduce_all (input_tensor = input_x , axis = [- 1 ], keepdims = True )
@@ -3629,14 +3629,14 @@ def func(input_x):
3629
3629
3630
3630
@check_opset_min_version (11 , "ReduceSum" )
3631
3631
def test_reduce_any_negative_axis (self ):
3632
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3632
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3633
3633
def func (x ):
3634
3634
res = tf .reduce_any (input_tensor = x , keepdims = False )
3635
3635
res1 = tf .reduce_any (input_tensor = x , axis = [- 1 ], keepdims = False )
3636
3636
return tf .identity (res , name = _TFOUTPUT ), tf .identity (res1 , name = _TFOUTPUT1 )
3637
3637
self ._run_test_case (func , [_OUTPUT , _OUTPUT1 ], {_INPUT : input_val })
3638
3638
3639
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3639
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3640
3640
def func (x ):
3641
3641
res = tf .reduce_any (input_tensor = x , keepdims = True )
3642
3642
res1 = tf .reduce_any (input_tensor = x , axis = [- 1 ], keepdims = True )
@@ -3646,13 +3646,31 @@ def func(x):
3646
3646
@check_opset_min_version (11 , "ReduceSum" )
3647
3647
@check_tf_min_version ("1.15" )
3648
3648
def test_reduce_any_empty_axis (self ):
3649
- input_val = np .random .randint (0 , 2 , (10 , 20 )).astype (np .bool )
3649
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3650
3650
def func (x ):
3651
3651
res = tf .reduce_any (input_tensor = x , keepdims = False )
3652
3652
res1 = tf .reduce_any (input_tensor = x , axis = [], keepdims = False )
3653
3653
return tf .identity (res , name = _TFOUTPUT ), tf .identity (res1 , name = _TFOUTPUT1 )
3654
3654
self ._run_test_case (func , [_OUTPUT , _OUTPUT1 ], {_INPUT : input_val })
3655
3655
3656
+ def test_reduce_all_scalar_axis (self ):
3657
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3658
+ def func (x ):
3659
+ res = tf .reduce_all (input_tensor = x , keepdims = False )
3660
+ res1 = tf .reduce_all (input_tensor = x , axis = 0 , keepdims = False )
3661
+ return tf .identity (res , name = _TFOUTPUT ), tf .identity (res1 , name = _TFOUTPUT1 )
3662
+ self ._run_test_case (func , [_OUTPUT , _OUTPUT1 ], {_INPUT : input_val })
3663
+
3664
+ @check_opset_min_version (13 , "ReduceSum" )
3665
+ @check_tf_min_version ("1.15" )
3666
+ def test_reduce_any_nonconst_axis (self ):
3667
+ input_val = np .random .randint (0 , 2 , (2 , 20 )).astype (np .bool )
3668
+ y_val = np .array ([1 ], np .int32 )
3669
+ def func (x , y ):
3670
+ res = tf .reduce_any (input_tensor = x , axis = y , keepdims = False )
3671
+ return tf .identity (res , name = _TFOUTPUT )
3672
+ self ._run_test_case (func , [_OUTPUT ], {_INPUT : input_val , _INPUT1 : y_val })
3673
+
3656
3674
@check_opset_min_version (7 , "fill" )
3657
3675
def test_zeros_like (self ):
3658
3676
input_x = np .random .random_sample ([10 , 20 ]).astype (np .float32 )
0 commit comments