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

Support for powf #660

Closed
louisfd opened this issue Aug 29, 2023 · 4 comments
Closed

Support for powf #660

louisfd opened this issue Aug 29, 2023 · 4 comments

Comments

@louisfd
Copy link

louisfd commented Aug 29, 2023

Support element-wise power function on tensors:
tensor.powf(x) where x is a scalar.

Similar to https://pytorch.org/docs/stable/generated/torch.pow.html when exponent is a scalar value.

@LaurentMazare
Copy link
Collaborator

Could you expand a bit more on what you would use this for?
In particular I'm wondering how important it is to support integer tensors on this, integer powers, etc.
(also obviously a quick workaround at the moment would be (tensor.log()? * x)?.exp()? though it's certainly inefficient and may have numerical precision issues)

@louisfd
Copy link
Author

louisfd commented Aug 29, 2023

The workaround does the job, thanks.
I only use it on floats, but I use it rather often so it would indeed benefit from having its own kernel.

@LaurentMazare
Copy link
Collaborator

Just merged #664 that adds this as a specialized op so hopefully this will be more efficient. Note that however we'll probably want to limit the number of basic ops so may well convert this back to being the workaround version at some point (but this shouldn't involve any user facing change).

@LaurentMazare
Copy link
Collaborator

Closing as complete but feel free to re-open if needed or to open a fresh issue.

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

No branches or pull requests

2 participants