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

Transforms fail in FAST_COMPILE #125

Open
ricardoV94 opened this issue Mar 19, 2022 · 1 comment
Open

Transforms fail in FAST_COMPILE #125

ricardoV94 opened this issue Mar 19, 2022 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@ricardoV94
Copy link
Contributor

ricardoV94 commented Mar 19, 2022

import aesara
import aesara.tensor as at

from aeppl.transforms import TransformValuesRewrite, LogTransform

x_rv = at.random.exponential()

opt = TransformValuesRewrite({x_rv: LogTransform()})
logp, (x_vv,) = aeppl.joint_logprob(x_rv, extra_rewrites=opt)

logp_fn = aesara.function([x_vv], logp, mode="FAST_COMPILE")

aesara.dprint(logp_fn)
Elemwise{add,no_inplace} [id A] 6
 |Check{mu > 0} [id B] 5
 | |Elemwise{switch,no_inplace} [id C] 4
 | | |Elemwise{ge,no_inplace} [id D] 3
 | | | |TransformedVariable [id E] 1
 | | | | |Elemwise{exp,no_inplace} [id F] 0
 | | | | | |<TensorType(float64, ())> [id G]
 | | | | |<TensorType(float64, ())> [id G]
 | | | |TensorConstant{0.0} [id H]
 | | |Elemwise{mul,no_inplace} [id I] 2
 | | | |TensorConstant{-1.0} [id J]
 | | | |TransformedVariable [id E] 1
 | | |TensorConstant{-inf} [id K]
 | |TensorConstant{True} [id L]
 |<TensorType(float64, ())> [id G]

A TransformedVariable is still present, but it shouldn't be.

@brandonwillard brandonwillard added bug Something isn't working help wanted Extra attention is needed labels Mar 19, 2022
@brandonwillard
Copy link
Member

brandonwillard commented Mar 19, 2022

I'm guessing that our canonicalizations still aren't stable between FAST_COMPILE and FAST_RUN and/or some rewrites that we assume are canonicalizations in AePPL actually aren't. We can always address this by adding those rewrites to AePPL's logprob_rewrites_db, but we should also consider whether or not the relevant rewrites actually should be canonicalizations in Aesara.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants