Skip to content
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

prod and prod_axis tensor operators #526

Closed
wbrickner opened this issue Jul 24, 2023 · 1 comment · Fixed by #1460
Closed

prod and prod_axis tensor operators #526

wbrickner opened this issue Jul 24, 2023 · 1 comment · Fixed by #1460
Assignees
Labels
feature The feature request

Comments

@wbrickner
Copy link
Contributor

Feature description

Product of all elements in a tensor, and those along a given axis, just like we have sum and sum_axis.

Feature motivation

Basic tensor operation missing. I personally need it for some ML research.

(Optional) Suggest a Solution

Current workaround is tensor.log().sum().exp(), but this is slower and should not be required of the end user.


It would also be nice, although it is a separate matter, to have function to sum/prod along multiple axes at once in parallel. Otherwise you need to do two sequential tensor operations which reduces parallelism utilization.

For instance, a 3D tensor could be summed along its first two axes, perhaps like tensor.sum_axes([0, 1]);, or tensor.prod_axes([1, 3]).

@antimora antimora added the feature The feature request label Jul 25, 2023
@antimora antimora changed the title prod and prod_axis prod and prod_axis tensor operators Mar 4, 2024
@antimora
Copy link
Collaborator

Linking someone's attempt to implement this: #1173

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature The feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants