Skip to content

Commit e34b656

Browse files
Fix some np.array calls
1 parent 13d977c commit e34b656

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

tensorflow_probability/python/math/special_test.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,7 @@ def testBetaincGradient(self, dtype):
200200
space = np.logspace(-2., 2., 10).tolist()
201201
space_x = np.linspace(0.01, 0.99, 10).tolist()
202202
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]]
207204

208205
# Wrap in tf.function and compile for faster computations.
209206
betainc = tf.function(tfp_math.betainc, autograph=False, jit_compile=True)
@@ -232,10 +229,7 @@ def testBetaincDerivativeFinite(self, dtype):
232229
space = np.logspace(np.log10(eps), 5.).tolist()
233230
space_x = np.linspace(eps, 1. - eps).tolist()
234231
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]]
239233

240234
def betainc_partials(a, b, x):
241235
return tfp_math.value_and_gradient(tfp_math.betainc, [a, b, x])[1]
@@ -439,10 +433,7 @@ def testBetaincSecondDerivativeFinite(self, dtype):
439433
space = np.logspace(-2., 2., 5).tolist()
440434
space_x = np.linspace(0.01, 0.99, 5).tolist()
441435
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]]
446437

447438
def betainc_partials(a, b, x):
448439
return tfp_math.value_and_gradient(tfp_math.betainc, [a, b, x])[1]

0 commit comments

Comments
 (0)