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
This rewrite takes advantage of the fact that if there are two consecutive inverse operations (inv(inv(input))), we get back our original input without having to compute inverse once.
580
+
581
+
Here, we check for direct inverse operations (inv/pinv) and allows for any combination of these "inverse" nodes to be simply rewritten.
582
+
583
+
Parameters
584
+
----------
585
+
fgraph: FunctionGraph
586
+
Function graph being optimized
587
+
node: Apply
588
+
Node of the function graph to be optimized
589
+
590
+
Returns
591
+
-------
592
+
list of Variable, optional
593
+
List of optimized variables, or None if no optimization was performed
594
+
"""
595
+
valid_inverses= (MatrixInverse, MatrixPinv)
596
+
# Check if its a valid inverse operation (either inv/pinv)
597
+
# In case the outer operation is an inverse, it directly goes to the next step of finding inner operation
598
+
# If the outer operation is not a valid inverse, we do not apply this rewrite
0 commit comments