daily pastebin goal
9%
SHARE
TWEET

Untitled

a guest Dec 16th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import timeit
  2. import numpy as np
  3.  
  4. setup_quantize_slow = """
  5. from test_quantize import quantize_slow
  6. """
  7. print("Pure python:", np.mean(np.array(timeit.Timer("import numpy as np; a = np.random.rand(100000).astype(float); n = 3; quantize_slow(a, n)", setup=setup_quantize_slow).repeat(7,10))))
  8.  
  9.  
  10. setup_quantize_fast = """
  11. from quantize import quantize
  12. """
  13.  
  14. print("C++ implementation:", np.mean(np.array(timeit.Timer("import numpy as np; a = np.random.rand(100000).astype(float); n = 3; quantize(a, n)", setup=setup_quantize_fast).repeat(7,10))))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top