Using Python 3 @ matrix multiply performance vs. numpy.dot() is the same

For clarity, consider using @ for matrix multiply instead of .dot() in Python/Numpy

import numpy as np
X = np.random.random((5000,5000))
Y = np.randcom.random((5000,5000))

%timeit X @ Y
1 loop, best of 3: 1.65 s per loop

%timeit X.dot(Y)
1 loop, best of 3: 1.65 s per loop

%timeit np.dot(X,Y)
1 loop, best of 3: 1.65 s per loop

Tags:

Categories:

Updated:

Leave a Comment