Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork10.9k
Open
Description
It appearsnumpy.argmax
performs extremely slow for certain array sizes.
Reproducing code example:
Example of slow performance:
importnumpyasnpnx,ny,nz=1280,960,100z=np.random.normal(60,5,nx*ny*nz).reshape(nz,ny,nx)%timeitnp.argmax(z,axis=0)10.1s ±43.7msperloop (mean ±std.dev.of7runs,1loopeach)
Incrementing the array by 1 drastically improves performance drastically:
importnumpyasnpnx,ny,nz=1281,960,100z=np.random.normal(60,5,nx*ny*nz).reshape(nz,ny,nx)%timeitnp.argmax(z,axis=0)330ms ±689µsperloop (mean ±std.dev.of7runs,1loopeach)
NumPy/Python version information:
>>> import sys, numpy; print(numpy.__version__, sys.version)1.20.0 3.9.1 (default, Feb 6 2021, 06:49:13) [GCC 10.2.0]