-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of convolve #2205
base: master
Are you sure you want to change the base?
Conversation
84ad9a8
to
6d8689f
Compare
View rendered docs @ https://intelpython.github.io/dpnp/pull/2205/index.html |
6d8689f
to
c6dde99
Compare
5f429be
to
6eb94b2
Compare
c6dde99
to
b39e5c9
Compare
4168f27
to
3a03fdc
Compare
3a03fdc
to
1c52d67
Compare
View rendered docs @ https://intelpython.github.io/dpnp/pull/2205/index.html |
Array API standard conformance tests for dpnp=0.18.0dev0=py312he4f9c94_66 ran successfully. |
@antonwolfy please review |
Co-authored-by: Vahid Tavanashad <120411540+vtavana@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vtavana thanks for the review
please re-review.
Co-authored-by: Anton <100830759+antonwolfy@users.noreply.github.com>
f"Received shapes: a.shape={a.shape}, v.shape={v.shape}" | ||
) | ||
|
||
a, v = dpnp.atleast_1d(a, v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It needs to be done prior lines#477-486, because should check type of input arrays first. Otherwise there might be AttributeError
exception raised:
np.convolve(1, 2)
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 np.convolve(1, 2)
File ~/code/dpnp/dpnp/dpnp_iface_statistics.py:477, in convolve(a, v, mode, method)
379 def convolve(a, v, mode="full", method="auto"):
380 r"""
381 Returns the discrete, linear convolution of two one-dimensional sequences.
382 The convolution operator is often seen in signal processing, where it
(...) 474
475 """
--> 477 if a.size == 0 or v.size == 0:
478 raise ValueError(
479 f"Array arguments cannot be empty. "
480 f"Received sizes: a.size={a.size}, v.size={v.size}"
481 )
482 if a.ndim > 1 or v.ndim > 1:
AttributeError: 'int' object has no attribute 'size'
Add implementation of
dpnp.convolve
. Implementation is mostly based on already existing functionality developed fordpnp.correlate
Similar to scipy.signal.convolve
method
keyword is introduced, but unlikescipy.signal.convolve
dpnp.convolve
works only with 1-d arrays.