-
Notifications
You must be signed in to change notification settings - Fork 52
RFC: update vecdot
to accept keepdims
and axis
to support tuples
#910
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
Comments
vecdot
have keepdims
?vecdot
accept keepdims
? axis
tuples?
vecdot
accept keepdims
? axis
tuples?vecdot
to accept keepdims
and axis
to support tuples
@mdhaber Your For multiple However, one thing here is the single-axis restriction may find its origins from BLAS, where acceleration is achieved via calls to |
Of course. For NumPy at least, yes, always. Often we do this with a decorator, even. This particular code was not handled like that already, though. And for So it can all be done. But was it intentional to leave these out of the standard? The features are included for other reducing functions1, so I thought I'd ask about
Sure, copies may be required if the data is not already oriented like BLAS needs it to be. Users are not required to use multiple axes, and they can be informed of the performance consequences if they choose to do so. The same goes for other reducing functions, too, right? Footnotes
|
I'm working on a PR for SciPy that replaces the
sum(x * y)
pattern withvecdot(x, y)
, since there are pretty substantial performance advantages. There is at least one place where the code currently relies on thekeepdims
argument ofsum
. Should that be accepted byvecdot
?How about
axis
tuples? I understand this does not look ideal, and I would also be happy if axis tuples were never allowed. But the motivation is the same - there are existing functions that usesum(x * y)
and supportaxis
tuples. Ifvecdot
doesn't allow them, these functions all have to manually ravel the axes ofx
andy
separately. (This operation can be moved into a helper function if need be, but hopefully it need not be.)The text was updated successfully, but these errors were encountered: