-
Notifications
You must be signed in to change notification settings - Fork 22
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
Correlation via fft implementation #2203
base: master
Are you sure you want to change the base?
Conversation
View rendered docs @ https://intelpython.github.io/dpnp/pull/2203/index.html |
f18bbf2
to
698c65e
Compare
2514037
to
6fc7166
Compare
698c65e
to
5963304
Compare
fbc94d0
to
fa3af10
Compare
5963304
to
5f429be
Compare
@@ -478,17 +482,57 @@ def _get_padding(a_size, v_size, mode): | |||
return l_pad, r_pad | |||
|
|||
|
|||
def _run_native_sliding_dot_product1d(a, v, l_pad, r_pad): | |||
def _choose_conv_method(a, v, rdtype): | |||
assert a.size >= v.size |
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.
Perhaps it is better to do:
assert a.size >= v.size | |
if a.size < v.size: | |
raise ValueError("a.size must not be smaller than v.size") |
assert a.size >= v.size | ||
assert l_pad < v.size |
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.
These assertions should be turned to checks that raise exceptions if unmet.
This is because Python interpreter allows to turn off assertion checks with -O
option:
(dev_dpctl) opavlyk@opavlyk-mobl:~/repos/dpctl$ python -O -c "assert False"
(dev_dpctl) opavlyk@opavlyk-mobl:~/repos/dpctl$ python -c "assert False"
Traceback (most recent call last):
File "<string>", line 1, in <module>
AssertionError
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.
These are an internal functions which are supposed to be called from already validated context.
These asserts are more reminders than an actual checks
I could convert them into checks but this would also decrease coverage statistics
dpnp/dpnp_iface_statistics.py
Outdated
|
||
# +1 is needed to avoid circular convolution | ||
padded_size = a.size + r_pad + 1 | ||
fft_size = 2 ** math.ceil(math.log2(padded_size)) |
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.
Since math.ceil
returns float
, it should be converted to integer:
fft_size = 2 ** math.ceil(math.log2(padded_size)) | |
fft_size = 2 ** int(math.ceil(math.log2(padded_size))) |
fa3af10
to
70a7d8d
Compare
936870b
to
be09e32
Compare
be09e32
to
91fd41f
Compare
5f429be
to
6eb94b2
Compare
91fd41f
to
943726f
Compare
method
tocorrelate
function similar to scipy correlatemethod == 'auto'
method is choosing automatically betweendirect
andfft
Depends on: #2180, #2202