Comments (4)
The rewrite can do the merge immediately, it's just not a local rewrite but a global one then.
Also if an Op has compute_uv=True but the arrays are not used in the graph we can set it to False. That can be a local rewrite, but probably fine to handle together in the same global rewrite
from pytensor.
Hi, I want to work on this. As I understand it, I will need to create a class SVDSimplify(GraphRewriter)
to file pytensor/tensor/rewriting/linalg.py
that check for SVD Op in PyTensor graph, and change the keyword argument compute_uv
of all of them to True if
- there are more than 1 SVD Ops.
- at least one of them has
compute_uv=True
.
From the documentation, I know roughly how I should do it. I am still not 100% sure on all the decorators used (e.g., @register_canonicalize
, @register_stabilize
, @register_specialize
, @node_rewriter()
etc.) but I will ask your inputs in the draft PR.
from pytensor.
tensor\rewritings\linalg\local_det_chol
is a good rewrite to look at, because it also uses the full FunctionGraph
(the first argument to the rewrite function. usually called fgraph
) to perform the rewrite.
The decorators tell pytensor at which step of the rewriting process the rewrite should be preformed. This one can come last, so I guess it should be @register_specialize
. It's a @node_rewriter
because it changes a single node of computation (an SVD
Op
with compute_uv=False
), as opposed to a @graph_rewriter
that operates on a whole group of nodes.
Tag me on your draft PR and I'm happy to walk you through the sharp bits.
from pytensor.
This one can come last, so I guess it should be @register_specialize
This one is pretty cheap that we can run in all 3 stages. It will only be triggered if there's an SVD Op anyway
from pytensor.
Related Issues (20)
- BUG: C backend is failing to handle elemwise scalarloop code HOT 2
- ENH: Default `steps` in `linspace` HOT 4
- Reductions along leading axes can be incredibly slow in C and Numba backends HOT 2
- Testing Shared Variables in torch
- Adding conditionals for torch HOT 3
- Extend inverse @ b as solve rewrite to batched dots
- Do we need dot Op to handle the vector cases?
- BUG: Unable to install pytensor as a package with pip install -e HOT 11
- ENH: Native support for dims in tensors and tensor operations HOT 7
- Delete `extra_ops.py`, replace with specialized files with more informative names
- Use contraction path to optimize `pt.nlinalg.matrix_dot`
- DOC: Fix Typographical Error in Contributing Guidelines HOT 2
- Bug in gradient of fft.rfft
- Simplify elemwise? HOT 2
- Numba cython support test failing with numba 0.60 and scipy 1.14.1
- Should IncSubtensor ignore duplicase by default, like numpy?
- Add rewrite for IncSubtensor(ignore_duplicates=True) when advanced indices are constant and contain no duplicates
- BUG: pytensor.config.cxx sets wrong compiler from old environment HOT 2
- Remove xfail mark from `tests/tensor/test_extra_ops.py::TestDiff::test_output_type`
- Warning about find_executable deprecation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytensor.