Numpy.dot o
See original GitHub issueProblem: numpy dot is throwing an exception, but the docs say it is supported.
Numba version: 0.38.0
Minimal Example:
import numpy as np
from numba import jit
@jit(nopython=True)
def matmul2(size: int):
a = np.random.random((size, size))
b = np.random.random((size, size))
return a.dot(b)
Expected: Should work Actual Result: Exception
Traceback (most recent call last):
File "test.py", line 209, in <module>
matmul2(1000)
File "C:\Program Files\Python36\Lib\site-packages\numba\dispatcher.py", line 344, in _compile_for_args
reraise(type(e), e, None)
File "C:\Program Files\Python36\Lib\site-packages\numba\six.py", line 658, in reraise
raise value.with_traceback(tb)
numba.errors.TypingError: Failed at nopython (nopython frontend)
Unknown attribute 'dot' of type array(float64, 2d, C)
File "test.py", line 204:
def matmul2(size: int):
<source elided>
b = np.random.random((size, size))
return a.dot(b)
^
[1] During: typing of get attribute at test.py (204)
File "test.py", line 204:
def matmul2(size: int):
<source elided>
b = np.random.random((size, size))
return a.dot(b)
^
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
numpy.dot — NumPy v1.24 Manual
Returns the dot product of a and b. If a and b are both scalars or both 1-D arrays then a scalar is...
Read more >numpy.dot() - Tutorialspoint
numpy.dot(), This function returns the dot product of two arrays. For 2-D vectors, it is the equivalent to matrix multiplication. For 1-D arrays, ......
Read more >numpy.dot() in Python - GeeksforGeeks
numpy.dot(vector_a, vector_b, out = None) returns the dot product of vectors a and b. It can handle 2D arrays but considers them as...
Read more >Numpy Dot, Explained - Sharp Sight
So when we use Numpy dot with one scalar and one Numpy array, it multiples every value of the array by the scalar...
Read more >numpy.dot() in Python - Javatpoint
The numpy module of Python provides a function to perform the dot product of two arrays. ... dot(a, b)[i,j,k,n] = sum(a[i,j,:] * b[k,:,n])....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
No, that did appear, I excluded it from my bug report up there to make it shorter.
The problem is that while the message is helpful, it just says “it is caused by an unsupported feature” which is correct, but the unsupported feature happens to be a trivial method call that should map to np.dot(), which is fully supported and hence the situation is confusing.
I’m sure people intimately familiar with numpy will understand that numpy.dot and numpy.ndarray.dot are different things but I didn’t and my colleagues were quite surprised as well. If your quick fix is not accepted, a little snipped saying “the method call form of numpy operations is not supported” would be quite helpful in the documentation.
No problem. The merge of https://github.com/numba/numba/pull/2946 will automatically close it.