You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, all the Aesara RandomVariableOps are being converted into in-place Ops (i.e. when a graph containing one of them is compiled and evaluated, the underlying shared variable RNG state is updated in place). This can be a mild convenience—and a potential efficiency gain—but it's not a good use of the RandomVariable API, because it can lead to confusion.
In other words, we shouldn't rely on in-place RandonVariableOps, and we should use explicitly updated RandomStates. This doesn't prevent us from using in-place updates for efficiency, especially since there's already an optimization that converts non-in-place RandomVariables to in-place ones.
Finally, we can automatically make sure that each RandomVariable created within a Model context is distinct by simply updating Model.default_rng after each RandomVariable is created in Distribution.__new__ (i.e. after this step).
The text was updated successfully, but these errors were encountered:
Currently, all the Aesara
RandomVariable
Op
s are being converted into in-placeOp
s (i.e. when a graph containing one of them is compiled and evaluated, the underlying shared variable RNG state is updated in place). This can be a mild convenience—and a potential efficiency gain—but it's not a good use of theRandomVariable
API, because it can lead to confusion.For example,
The compiled graph contains only one
RandomVariable
.The merge optimizations removed the second
RandomVariable
because it was identical to the first, and we need only produce the same samples once.If we want to make sure that Aesara knows these two
RandomVariable
s are distinct terms, we can provide a distinct RNG state for each:In other words, we shouldn't rely on in-place
RandonVariable
Op
s, and we should use explicitly updatedRandomState
s. This doesn't prevent us from using in-place updates for efficiency, especially since there's already an optimization that converts non-in-placeRandomVariable
s to in-place ones.Finally, we can automatically make sure that each
RandomVariable
created within aModel
context is distinct by simply updatingModel.default_rng
after eachRandomVariable
is created inDistribution.__new__
(i.e. after this step).The text was updated successfully, but these errors were encountered: