Created
November 22, 2020 09:43
-
-
Save Hiroki-Kawakami/a7740e043afac9497f0411c2593d8219 to your computer and use it in GitHub Desktop.
Benchmark numpy with matrix multiplication
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from time import time | |
np.__config__.show() | |
np.random.seed(0) | |
size = 4096 | |
A, B = np.random.rand(size, size), np.random.rand(size, size) | |
N = 20 | |
t = time() | |
for i in range(N): | |
np.dot(A, B) | |
delta = time() - t | |
print('Dotted two %dx%d matrices in %0.2f s.' % (size, size, delta / N)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment