GithubHelp home page GithubHelp logo

Comments (4)

ricardoV94 avatar ricardoV94 commented on September 27, 2024 2

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.

HangenYuu avatar HangenYuu commented on September 27, 2024 1

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

  1. there are more than 1 SVD Ops.
  2. 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.

jessegrabowski avatar jessegrabowski commented on September 27, 2024

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.

ricardoV94 avatar ricardoV94 commented on September 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.