Skip to content

Instantly share code, notes, and snippets.

@alexbw
Created February 24, 2017 21:45
Show Gist options
  • Save alexbw/46517344ac817b76fd4e60daa1da474a to your computer and use it in GitHub Desktop.
Save alexbw/46517344ac817b76fd4e60daa1da474a to your computer and use it in GitHub Desktop.
Line # Hits Time Per Hit % Time Line Contents
==============================================================
6 def grad_fn(x):
7 1 5 5.0 0.3 x_stack = deque()
8 1 2 2.0 0.1 (_eebd10_stack, _eebd10) = (deque(), None)
9 1 1 1.0 0.1 (_dab857_stack, _dab857) = (deque(), None)
10 1 1 1.0 0.1 (_14c3e8_stack, _14c3e8) = (deque(), None)
11 1 3 3.0 0.2 _eebd10 = range(100)
12 1 2 2.0 0.1 _eebd10_stack.append(_eebd10)
13 101 73 0.7 5.0 for i in _eebd10:
14 100 758 7.6 52.3 _dab857 = (np.sum(x) > 1)
15 100 91 0.9 6.3 _dab857_stack.append(_dab857)
16 100 69 0.7 4.8 if _dab857:
17 3 3 1.0 0.2 x_stack.append(x)
18 3 22 7.3 1.5 x = (x / 2)
19 1 6 6.0 0.4 _14c3e8 = np.sum(x)
20 1 1 1.0 0.1 g__14c3e8 = 1.0
21 1 0 0.0 0.0 g_x = 0
22 1 83 83.0 5.7 g_x += repeat_to_match_shape(g__14c3e8, x, None, False)[0]
23 1 2 2.0 0.1 _eebd10 = _eebd10_stack.pop()
24 1 2 2.0 0.1 _eebd10 = reversed(_eebd10)
25 101 63 0.6 4.4 for i in _eebd10:
26 100 68 0.7 4.7 _dab857 = _dab857_stack.pop()
27 100 63 0.6 4.4 if _dab857:
28 3 2 0.7 0.1 x = x_stack.pop()
29 3 112 37.3 7.7 tmp_g0 = sum_to_match_shape((g_x / 2), x)
30 3 3 1.0 0.2 g_x = 0
31 3 12 4.0 0.8 g_x += tmp_g0
32 1 1 1.0 0.1 return g_x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment