-
-
Notifications
You must be signed in to change notification settings - Fork 154
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
Fix some usability issues surrounding shared RNG objects #454
Comments
One possible limitation concerns variable replacements, an example of which emerged here: pymc-devs/pymc#4903 (comment) Maybe we could solve it at compile time instead? Is it possible for a rewrite to manipulate the default_update of Shared variables? @local_optimizer([RandomVariable])
def rv_default_update(node, fgraph):
rng = node.owner.inputs[0]
if not hasattr(rng, "default_update"):
rng.default_update = rv.owner.outputs[0] |
That's a great question, and I'm confident that this idea will be important at some point. One of the issues with this is that the updates are returned to the user as an object that's independent from the graph that uses the updates, so there's always the chance that users will manually specify updates when calling Aside from that, I believe that updates-generating |
Following up on a Gitter conversation about this, it's really the interaction between Those attributes are added to the outputs of We need to do something so that effectively arbitrary use of shared RNG objects is possible. For instance, we could change That and/or we should make it very clear that |
default_update
in RandomVariable.make_node
Work on pymc-devs/pymc#4729 has highlighted a potential confusion involving
RandomStateSharedVariable
s and in-place optimizations likerandom_make_inplace
.The problem is that in-place optimizations won't be performed on
RandomStateSharedVariable
s that do not have updates specified, since they're protected by theFunctionGraph
Supervisor
feature set up byaesara.compile.function.types.std_fgraph
.In order to get around this, one can add/use the
default_update
property on theRandomStateSharedVariable
(e.g. see here andRandomStream.gen
); however, this isn't set automatically, so it can lead to confusion.Let's consider adding the
default_update
property automatically. This could probably be done inRandomVariable.make_node
, but we first need to consider whether or not this will have other repercussions/restrictions/etc.The text was updated successfully, but these errors were encountered: