Skip to content

Value variables are not replaced upstream of unvalued RandomVariables #174

@ricardoV94

Description

@ricardoV94
import aesara.tensor as at
import aeppl

x_rv = at.random.normal(name="x")
y_rv = at.random.normal(x_rv, name="y")
z_rv = at.random.normal(y_rv, name="z")

x_vv = x_rv.clone()
z_vv = z_rv.clone()

# No value variable is given to `y_rv`
logp_dict = aeppl.factorized_joint_logprob({x_rv: x_vv, z_rv: z_vv})
logp_dict[z_vv].eval({x_vv: 0})  # MissingInputError

The logprob of z_rv does not depend on x_vv in the example above, because we short-circuit here:

aeppl/aeppl/utils.py

Lines 131 to 136 in 8ce3c63

if (
var.owner
and (walk_past_rvs or not isinstance(var.owner.op, MeasurableVariable))
and (var not in stop_at_vars)
):
new_vars.extend(reversed(var.owner.inputs))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions