Skip to content

Commit 58a202a

Browse files
froystigGoogle-ML-Automation
authored andcommitted
fix binomial sample test on TPU
The recent partitionable Threefry upgrade affects binomial sampling under the RBG PRNG scheme because the implementation of `jax.random.binomial` derives internal subkeys with a call to `split`. This led a randomized test to fail by pushing its numeric closeness check just beyond its current relative tolerance. This is very likely a false failure, so we update the rtol. PiperOrigin-RevId: 723100174
1 parent 9f79799 commit 58a202a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/random_lax_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1219,7 +1219,7 @@ def testBinomialSample(self, n, p, dtype):
12191219
for samples in [uncompiled_samples, compiled_samples]:
12201220
self._CheckChiSquared(samples.astype(int), pmf, pval=1e-3)
12211221
self.assertAllClose(samples.mean(), n * p, rtol=0.025, check_dtypes=False)
1222-
self.assertAllClose(samples.var(), n * p * (1 - p) , rtol=0.035,
1222+
self.assertAllClose(samples.var(), n * p * (1 - p) , rtol=0.036,
12231223
check_dtypes=False)
12241224

12251225
def testBinomialCornerCases(self):

0 commit comments

Comments
 (0)