File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed
ivy/functional/frontends/paddle
ivy_tests/test_ivy/test_frontends/test_paddle Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -629,13 +629,8 @@ def square(x, name=None):
629
629
@with_supported_dtypes ({"2.6.0 and below" : ("float32" , "float64" )}, "paddle" )
630
630
@to_ivy_arrays_and_back
631
631
def stanh (x , scale_a = 0.67 , scale_b = 1.7159 , name = None ):
632
- # TODO this function will be simplified as soon as the ivy.stanh(x,a,b) is added
633
- exp_ax = ivy .exp (ivy .multiply (scale_a , x ))
634
- exp_minus_ax = ivy .exp (ivy .multiply (- scale_a , x ))
635
- numerator = ivy .subtract (exp_ax , exp_minus_ax )
636
- denominator = ivy .add (exp_ax , exp_minus_ax )
637
- ret = ivy .multiply (scale_b , ivy .divide (numerator , denominator ))
638
- return ret
632
+ ret = ivy .stanh (x , alpha = scale_b , beta = scale_a , out = name )
633
+ return ivy .asarray (ret , dtype = x .dtype )
639
634
640
635
641
636
@with_unsupported_dtypes ({"2.6.0 and below" : ("float16" , "bfloat16" )}, "paddle" )
Original file line number Diff line number Diff line change @@ -2495,8 +2495,20 @@ def test_paddle_square(
2495
2495
dtype_and_x = helpers .dtype_and_values (
2496
2496
available_dtypes = helpers .get_dtypes ("float" ),
2497
2497
),
2498
- scale_a = st .floats (1e-5 , 1e5 ),
2499
- scale_b = st .floats (1e-5 , 1e5 ),
2498
+ scale_a = st .floats (
2499
+ min_value = - 5 ,
2500
+ max_value = 5 ,
2501
+ allow_nan = False ,
2502
+ allow_subnormal = False ,
2503
+ allow_infinity = False ,
2504
+ ),
2505
+ scale_b = st .floats (
2506
+ min_value = - 5 ,
2507
+ max_value = 5 ,
2508
+ allow_nan = False ,
2509
+ allow_subnormal = False ,
2510
+ allow_infinity = False ,
2511
+ ),
2500
2512
)
2501
2513
def test_paddle_stanh (
2502
2514
* ,
You can’t perform that action at this time.
0 commit comments