Skip to content

Commit 13d977c

Browse files
Fix evaluation method calls
1 parent ba726ee commit 13d977c

File tree

1 file changed

+7
-21
lines changed

1 file changed

+7
-21
lines changed

tensorflow_probability/python/math/special_test.py

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,11 @@ def testBetainc(self):
178178
strm = test_util.test_seed_stream()
179179
a = tfp.distributions.HalfCauchy(
180180
loc=np.float64(1.), scale=15.).sample(2000, strm())
181-
a = self.evaluate(a)
182181
b = tfp.distributions.HalfCauchy(
183182
loc=np.float64(1.), scale=15.).sample(2000, strm())
184-
b = self.evaluate(b)
185183
x = tfp.distributions.Uniform(
186184
high=np.float64(1.)).sample(2000, strm())
187-
x = self.evaluate(x)
185+
a, b, x = self.evaluate([a, b, x])
188186

189187
self.assertAllClose(
190188
scipy_special.betainc(a, b, x),
@@ -332,13 +330,11 @@ def testBetaincDerivativeVerySmallFloat(self):
332330
strm = test_util.test_seed_stream()
333331
a = tfp.distributions.HalfNormal(
334332
scale=np.float32(1e-8)).sample(100, strm())
335-
a = self.evaluate(a)
336333
b = tfp.distributions.HalfNormal(
337334
scale=np.float32(1e-8)).sample(100, strm())
338-
b = self.evaluate(b)
339335
x = tfp.distributions.Uniform(
340336
high=np.float32(1.)).sample(100, strm())
341-
x = self.evaluate(x)
337+
a, b, x = self.evaluate([a, b, x])
342338

343339
self._testBetaincDerivative(
344340
a, b, x, rtol_a=0.05, rtol_b=0.05, rtol_x=1e-5)
@@ -348,13 +344,11 @@ def testBetaincDerivativeSmallFloat(self):
348344
strm = test_util.test_seed_stream()
349345
a = tfp.distributions.Uniform(
350346
high=np.float32(5.)).sample(100, strm())
351-
a = self.evaluate(a)
352347
b = tfp.distributions.Uniform(
353348
high=np.float32(5.)).sample(100, strm())
354-
b = self.evaluate(b)
355349
x = tfp.distributions.Uniform(
356350
high=np.float32(1.)).sample(100, strm())
357-
x = self.evaluate(x)
351+
a, b, x = self.evaluate([a, b, x])
358352

359353
self._testBetaincDerivative(
360354
a, b, x, atol_a=1e-3, atol_b=1e-3, atol_x=0.01)
@@ -364,13 +358,11 @@ def testBetaincDerivativeFloat(self):
364358
strm = test_util.test_seed_stream()
365359
a = tfp.distributions.Uniform(
366360
high=np.float32(100.)).sample(100, strm())
367-
a = self.evaluate(a)
368361
b = tfp.distributions.Uniform(
369362
high=np.float32(100.)).sample(100, strm())
370-
b = self.evaluate(b)
371363
x = tfp.distributions.Uniform(
372364
high=np.float32(1.)).sample(100, strm())
373-
x = self.evaluate(x)
365+
a, b, x = self.evaluate([a, b, x])
374366

375367
self._testBetaincDerivative(
376368
a, b, x, atol_a=1e-3, atol_b=1e-3, atol_x=1e-3)
@@ -380,13 +372,11 @@ def testBetaincDerivativeVerySmallDouble(self):
380372
strm = test_util.test_seed_stream()
381373
a = tfp.distributions.HalfNormal(
382374
scale=np.float64(1e-16)).sample(100, strm())
383-
a = self.evaluate(a)
384375
b = tfp.distributions.HalfNormal(
385376
scale=np.float64(1e-16)).sample(100, strm())
386-
b = self.evaluate(b)
387377
x = tfp.distributions.Uniform(
388378
high=np.float64(1.)).sample(100, strm())
389-
x = self.evaluate(x)
379+
a, b, x = self.evaluate([a, b, x])
390380

391381
self._testBetaincDerivative(
392382
a, b, x, rtol_a=1e-11, rtol_b=1e-11, rtol_x=1e-13)
@@ -396,13 +386,11 @@ def testBetaincDerivativeSmallDouble(self):
396386
strm = test_util.test_seed_stream()
397387
a = tfp.distributions.Uniform(
398388
high=np.float64(10.)).sample(100, strm())
399-
a = self.evaluate(a)
400389
b = tfp.distributions.Uniform(
401390
high=np.float64(10.)).sample(100, strm())
402-
b = self.evaluate(b)
403391
x = tfp.distributions.Uniform(
404392
high=np.float64(1.)).sample(100, strm())
405-
x = self.evaluate(x)
393+
a, b, x = self.evaluate([a, b, x])
406394

407395
self._testBetaincDerivative(
408396
a, b, x, atol_a=1e-12, atol_b=1e-12, atol_x=1e-11)
@@ -412,13 +400,11 @@ def testBetaincDerivativeDouble(self):
412400
strm = test_util.test_seed_stream()
413401
a = tfp.distributions.Uniform(
414402
high=np.float64(100.)).sample(100, strm())
415-
a = self.evaluate(a)
416403
b = tfp.distributions.Uniform(
417404
high=np.float64(100.)).sample(100, strm())
418-
b = self.evaluate(b)
419405
x = tfp.distributions.Uniform(
420406
high=np.float64(1.)).sample(100, strm())
421-
x = self.evaluate(x)
407+
a, b, x = self.evaluate([a, b, x])
422408

423409
self._testBetaincDerivative(
424410
a, b, x, atol_a=1e-12, atol_b=1e-12, atol_x=1e-10)

0 commit comments

Comments
 (0)