Skip to content
Discussion options

You must be logged in to vote

Ahh, I think I'm understanding and I hit a red-herring when I'm trying to debug. I should keep track of the variable, not the expanded-dimension one, when I'm trying to build these graphs and use clone_replace. Here's why:

>>> debugprint(dist_expr.owner.inputs[0].owner.inputs[0])
Exp [id A]
 └─ Mul [id B]
    ├─ Mul [id C]
    │  ├─ ExpandDims{axes=[0, 1]} [id D]
    │  │  └─ c [id E]
    │  └─ ExpandDims{axis=1} [id F] 'x'
    │     └─ x [id G]
    └─ ExpandDims{axis=1} [id H] 'y'
       └─ y [id I]

>>> function([x_var, y_var, c_var], dist_expr.owner.inputs[0].owner.inputs[0])
<pytensor.compile.function.types.Function object at 0x1385dfd40>

This works absolutely fine (a subgraph here). …

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@kratsg
Comment options

Answer selected by kratsg
@kratsg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant