MCPcopy Create free account
hub / github.com/Kaggle/docker-python / TestJAX

Class TestJAX

tests/test_jax.py:13–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11
12
13class TestJAX(unittest.TestCase):
14 def tanh(self, x):
15 y = np.exp(-2.0 * x)
16 return (1.0 - y) / (1.0 + y)
17
18 def test_grad(self):
19 grad_tanh = grad(self.tanh)
20 ag = grad_tanh(1.0)
21 self.assertEqual(0.4199743, ag)
22
23 def test_backend(self):
24 expected_backend = 'cpu' if not isGPU() else 'gpu'
25 self.assertEqual(expected_backend, jax.default_backend())

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected