Closed
Description
Current status
Apple is aware of this issue, see this comment below. Hopefully an OS update will have a fix soon. If you are experiencing this issue on a Mac with an M4 CPU it is not necessary to comment on this thread about it.
Describe the issue:
I guess its self explanatory. Following code:
np.identity(n=784) @ np.identity(n=784)
produces many wrong runtime warnings.
For small matrices is works as expected, for eg. np.identity(14) @ np.identity(14)
doesn't produce warning but np.identity(15) @ np.identity(15)
and bigger does.
Reproduce the code example:
import numpy as np
np.identity(n=15) @ np.identity(n=15) # produces warning
np.identity(n=14) @ np.identity(n=14) # no warning
# same result for
import numpy as np
np.ones(shape=(1, 2)) @ np.ones(shape=(2, 784))
Error message:
../test.py:3: RuntimeWarning: divide by zero encountered in matmul
np.identity(n=784) @ np.identity(n=784)
../test.py:3: RuntimeWarning: overflow encountered in matmul
np.identity(n=784) @ np.identity(n=784)
../test.py:3: RuntimeWarning: invalid value encountered in matmul
np.identity(n=784) @ np.identity(n=784)
Python and NumPy Versions:
2.2.4
3.13.2 | packaged by Anaconda, Inc. | (main, Feb 6 2025, 12:55:35) [Clang 14.0.6 ]
I've checked also 3.11
& 3.9
but same result.
Runtime Environment:
No response
Context for the issue:
No response