def testAllClose(self):
    rng = onp.random.RandomState(0)
    x = rng.randn(2, 2)
    y = rng.randn(2)

    def same(list1, list2):
        allclose = functools.partial(jnp.allclose, atol=0.001, rtol=0.001)
        elements_close = list(map(allclose, list1, list2))
        return jnp.all(jnp.array(elements_close))
    csame = api.jit(same)
    a1 = same((x, y), (x, y))
    a2 = csame((x, y), (x, y))
    a3 = csame((x, y), (x, (2 * y)))
    self.assertTrue(a1)
    self.assertTrue(a2)
    self.assertFalse(a3)
def testAllClose(self):
    rng = onp.random.RandomState(0)
    x = rng.randn(2, 2)
    y = rng.randn(2)

    def same(list1, list2):
        allclose = functools.partial(jnp.allclose, atol=0.001, rtol=0.001)
        elements_close = list(map(allclose, list1, list2))
        return jnp.all(jnp.array(elements_close))
    csame = api.jit(same)
    a1 = same((x, y), (x, y))
    a2 = csame((x, y), (x, y))
    a3 = csame((x, y), (x, (2 * y)))
    self.assertTrue(a1)
    self.assertTrue(a2)
    self.assertFalse(a3)