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

Method go_fast

tests/test_numba.py:13–17  ·  view source on GitHub ↗
(a)

Source from the content-addressed store, hash-verified

11
12 @jit(nopython=True) # Set "nopython" mode for best performance, equivalent to @njit
13 def go_fast(a): # Function is compiled to machine code when called the first time
14 trace = 0.0
15 for i in range(a.shape[0]): # Numba likes loops
16 trace += np.tanh(a[i, i]) # Numba likes NumPy functions
17 return a + trace # Numba likes NumPy broadcasting
18
19 self.assertEqual(10, go_fast(x).shape[0])
20

Callers

nothing calls this directly

Calls 1

tanhMethod · 0.80

Tested by

no test coverage detected