Skip to content

Accessing unobserved_value_vars changes model in place #7054

Closed
@ricardoV94

Description

@ricardoV94

Description

Reported in https://discourse.pymc.io/t/missinginputerror-when-sampling-data/13426

import pytensor
import pymc as pm

with pm.Model() as m:
    theta1 = pm.Normal("theta1", 0, 1)
    theta2 = pm.Uniform("theta2", -theta1, theta1)

pytensor.dprint(theta2)
m.unobserved_value_vars
pytensor.dprint(theta2)  # Now includes the value var of theta1 in the graph!

theta2.eval()  # MissingInputError

Caused by the recent refactor in #6976
One of the replace functions that is now used causes an inplace change that was not caused by the previous one

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions