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