`np.multiply` vs. `*`
See original GitHub issueIn the course of our work over on dipy, we stumbled into the following behavior:
The following line: https://github.com/nipy/dipy/blob/master/dipy/denoise/shift_twist_convolution.pyx#L68
raises this error (on np 1.11, but not earlier):
Traceback (most recent call last):
File "contextual_enhancement.py", line 149, in <module>
sh_order=8, test_mode=True)
File "dipy/denoise/shift_twist_convolution.pyx", line 68, in dipy.denoise.shift_twist_convolution.convolve (dipy/denoise/shift_twist_convolution.c:2147)
TypeError: 'numpy.float64' object cannot be interpreted as an index
When changed to this:
This error no longer occurs. What does the error mean (it’s a bit opaque in this context), and how do we avoid it in the future?
Thanks!
Issue Analytics
- State:
- Created 8 years ago
- Comments:19 (17 by maintainers)
Top Results From Across the Web
Numpy np.multiply vs *-Operator [duplicate] - Stack Overflow
There is no difference. However, the np.multiply function can take in additional, optional arguments, making it more versatile.
Read more >numpy.multiply — NumPy v1.24 Manual
Input arrays to be multiplied. If x1.shape != x2.shape , they must be broadcastable to a common shape (which becomes the shape of...
Read more >How to Use the Numpy Multiply Function - Sharp Sight
Here, np.multiply is multiplying together the values of each input matrix, element-wise. And image that shows how np.multiply multiples two same ...
Read more >What Should I Use for Dot Product and Matrix Multiplication?
np.multiply is basically the same as * . It is a NumPy 's version of element-wise multiplication instead of Python's native operator ...
Read more >numpy.multiply() in Python - GeeksforGeeks
numpy.multiply() function is used when we want to compute the multiplication of two array. It returns the product of arr1 and arr2, element-wise ......
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 FreeTop 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
Top GitHub Comments
The reason should be that
output
is actually a sequence and not an ndarray but you actuallyClose it, as the last comment said:
raises and mismatches with 0-D arrays. But that is tricky and most of the discussion is about things that are not relevant anymore. We should just open a new issue when we run into it again.