How is numpy multi_dot slower than numpy.dot?
问题 I'm trying to optimize some code that performs lots of sequential matrix operations. I figured numpy.linalg.multi_dot (docs here) would perform all the operations in C or BLAS and thus it would be way faster than going something like arr1.dot(arr2).dot(arr3) and so on. I was really surprised running this code on a notebook: v1 = np.random.rand(2,2) v2 = np.random.rand(2,2) %%timeit v1.dot(v2.dot(v1.dot(v2))) The slowest run took 9.01 times longer than the fastest. This could mean that an