Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. import time
  2.  
  3. import numpy as np
  4.  
  5. num_loops = 50
  6. img_1 = np.ones((1000, 1000), np.int64) * 5
  7. img_2 = np.ones((1000, 1000), np.int64) * 10
  8. img_3 = np.ones((1000, 1000), np.int64) * 15
  9.  
  10. def add_arrays(img_1, img_2, img_3):
  11. return np.square(img_1 + img_2 + img_3)
  12.  
  13. start = time.time()
  14.  
  15. for i in range(num_loops):
  16. result = add_arrays(img_1, img_2, img_3)
  17.  
  18. end = time.time()
  19. run_time = end - start
  20.  
  21. print("Average time = {}".format(run_time / num_loops))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement