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

fgraph_from_model fails when cloning shared variables with specialized static shape #7105

Closed
ricardoV94 opened this issue Jan 15, 2024 · 0 comments · Fixed by #7153
Closed
Assignees

Comments

@ricardoV94
Copy link
Member

ricardoV94 commented Jan 15, 2024

Description

import pymc as pm
from pymc.model.fgraph import fgraph_from_model

with pm.Model() as m:
    x = pm.MutableData("x", [0, 0, 0], shape=(3,))

fgraph_from_model(m)
---------------------------------------------------------------------------
AssertionError                            Traceback (most recent call last)
Cell In[19], line 8
      4 with pm.Model() as m:
      5     x = pm.MutableData("x", [0, 0, 0], shape=(3,))
----> 8 fgraph_from_model(m)

File ~/miniconda3/envs/colgate-shelf-sow2/lib/python3.11/site-packages/pymc/model/fgraph.py:204, in fgraph_from_model(model, inlined_views)
    201 else:
    202     new_var = shared(var.get_value(borrow=False))
--> 204 assert new_var.type == var.type
    205 new_var.name = var.name
    206 new_var.tag = copy(var.tag)

AssertionError: 

We need to pass the right kwargs (like shape), when recreating the shared variable. We should check if there's a general way to achieve this. Maybe a method should be added to Shared Variables in PyTensor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant