Work around the following bug in python 3.8

OverflowError: Python int too large to convert to C long

On windows, sizeof(long) is 4 bytes. Therefore, the large integers seem to be a problem when backed by some numpy types:
https://stackoverflow.com/questions/38314118/overflowerror-python-int-too-large-to-convert-to-c-long-on-windows-but-not-ma

PiperOrigin-RevId: 301407257
Change-Id: Ic0f7379eee360ff053283742f6495c1974b2c5e4
This commit is contained in:
Gunhan Gulsoy 2020-03-17 10:50:24 -07:00 committed by TensorFlower Gardener
parent 73278044ba
commit bdb77d1e2e
2 changed files with 2 additions and 2 deletions

View File

@ -187,7 +187,7 @@ class CategoricalTest(xla_test.XLATestCase):
0,
seed=seed_t,
output_dtype=dtypes.int32)
y = sess.run(x, {seed_t: [0x12345678, 0xabcdef12]})
y = sess.run(x, {seed_t: [0x12345678, 0xabcdef1]})
self.assertEqual(y.shape, (42, 0))

View File

@ -101,7 +101,7 @@ class StatelessRandomOpsTest(xla_test.XLATestCase):
seed_t = array_ops.placeholder(dtypes.int32, shape=[2])
x = stateless.stateless_random_normal(
shape=[10000], seed=seed_t, dtype=dtype)
y = sess.run(x, {seed_t: [0x12345678, 0xabcdef12]})
y = sess.run(x, {seed_t: [0x12345678, 0xabcdef1]})
self.assertTrue(np.all(np.isfinite(y)))
def testDistributionOfStatelessRandomNormal(self):