@@ -200,10 +200,7 @@ def testBetaincGradient(self, dtype):
200
200
space = np .logspace (- 2. , 2. , 10 ).tolist ()
201
201
space_x = np .linspace (0.01 , 0.99 , 10 ).tolist ()
202
202
a , b , x = zip (* list (itertools .product (space , space , space_x )))
203
-
204
- a = np .array (a , dtype = dtype )
205
- b = np .array (b , dtype = dtype )
206
- x = np .array (x , dtype = dtype )
203
+ a , b , x = [np .array (z , dtype = dtype ) for z in [a , b , x ]]
207
204
208
205
# Wrap in tf.function and compile for faster computations.
209
206
betainc = tf .function (tfp_math .betainc , autograph = False , jit_compile = True )
@@ -232,10 +229,7 @@ def testBetaincDerivativeFinite(self, dtype):
232
229
space = np .logspace (np .log10 (eps ), 5. ).tolist ()
233
230
space_x = np .linspace (eps , 1. - eps ).tolist ()
234
231
a , b , x = zip (* list (itertools .product (space , space , space_x )))
235
-
236
- a = np .array (a , dtype = dtype )
237
- b = np .array (b , dtype = dtype )
238
- x = np .array (x , dtype = dtype )
232
+ a , b , x = [np .array (z , dtype = dtype ) for z in [a , b , x ]]
239
233
240
234
def betainc_partials (a , b , x ):
241
235
return tfp_math .value_and_gradient (tfp_math .betainc , [a , b , x ])[1 ]
@@ -439,10 +433,7 @@ def testBetaincSecondDerivativeFinite(self, dtype):
439
433
space = np .logspace (- 2. , 2. , 5 ).tolist ()
440
434
space_x = np .linspace (0.01 , 0.99 , 5 ).tolist ()
441
435
a , b , x = zip (* list (itertools .product (space , space , space_x )))
442
-
443
- a = np .array (a , dtype = dtype )
444
- b = np .array (b , dtype = dtype )
445
- x = np .array (x , dtype = dtype )
436
+ a , b , x = [np .array (z , dtype = dtype ) for z in [a , b , x ]]
446
437
447
438
def betainc_partials (a , b , x ):
448
439
return tfp_math .value_and_gradient (tfp_math .betainc , [a , b , x ])[1 ]
0 commit comments