We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
sub(x, neg(y))
Seems like we are missing a canonicalization for sub(x, neg(y)) -> add(x, y) :
sub(x, neg(y)) -> add(x, y)
import aesara import aesara.tensor as at x = at.scalar("x") y = at.scalar("y") z = x - (-y) f = aesara.function([x, y], z) aesara.dprint(f)
Elemwise{Composite{(i0 - (-i1))}} [id A] '' 0 |x [id B] |y [id C]
It does work with constants
z = 5 - (-x) f = aesara.function([x], z) aesara.dprint(f)
Elemwise{add,no_inplace} [id A] '' 0 |TensorConstant{5.0} [id B] |x [id C]
And we have one for double negation:
z = - (-x) f = aesara.function([x], z) aesara.dprint(f)
DeepCopyOp [id A] 'x' 0 |x [id B]
Originally posted by @ricardoV94 in #473 (comment)
The text was updated successfully, but these errors were encountered:
We might also want to canonicalize -x + y -> y - x.
-x + y -> y - x
Not sure if it is a faster operation, but some lazy benchmarks on Colab suggest so. In any case it might be worth it just as a canonicalization.
Sorry, something went wrong.
ricardoV94
Successfully merging a pull request may close this issue.
Seems like we are missing a canonicalization for
sub(x, neg(y)) -> add(x, y)
:It does work with constants
And we have one for double negation:
Originally posted by @ricardoV94 in #473 (comment)
The text was updated successfully, but these errors were encountered: