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
Yeah my idea was to cast a wider net. Right now, the rewrite checks for "triangularity" by looking for a Cholesky parent node. So this graph is rewritten:
importpytensor.tensorasptimportpytensorA=pt.dmatrix("A")
b=pt.dmatrix('b')
L=pt.linalg.cholesky(A)
x=pt.linalg.solve(L, b)
f=pytensor.function([A, b], x)
But, importantly for PyMC users, this graph is not rewritten:
importpymcaspmL2, *_=pm.LKJCholeskyCov.dist(n=3, sd_dist=pm.Exponential.dist(1), eta=1)
x2=pt.linalg.solve(L2, b)
f2=pytensor.function([b], x2)
Because the cholesky factorized matrix returned by LKJCholeskyCov isn't actually created via the CholeskyOp. My thought was this case could be caught by looking at the new tags instead?
I also wanted to verify that if we have a tagged triangular matrix, pt.linalg.inv(L) gets re-written to pt.linalg.triangular_solve(L, pt.eye(L.shape[0])) via sequential application of rewrites. I think it should, but I also didn't check.
Also should we make the outputs of "Cholesky" have such a tag from the get go?
Yes, this was my thinking
The text was updated successfully, but these errors were encountered:
ricardoV94
changed the title
Yeah my idea was to cast a wider net. Right now, the rewrite checks for "triangularity" by looking for a Cholesky parent node. So this graph is rewritten:
Expand linalg rewrites based on "triangular" tag
Jul 15, 2023
Uh oh!
There was an error while loading. Please reload this page.
Originally posted by @jessegrabowski in #382 (comment):
Yeah my idea was to cast a wider net. Right now, the rewrite checks for "triangularity" by looking for a Cholesky parent node. So this graph is rewritten:
But, importantly for PyMC users, this graph is not rewritten:
Because the cholesky factorized matrix returned by LKJCholeskyCov isn't actually created via the
Cholesky
Op
. My thought was this case could be caught by looking at the new tags instead?I also wanted to verify that if we have a tagged triangular matrix,
pt.linalg.inv(L)
gets re-written topt.linalg.triangular_solve(L, pt.eye(L.shape[0]))
via sequential application of rewrites. I think it should, but I also didn't check.Yes, this was my thinking
The text was updated successfully, but these errors were encountered: