Giter VIP home page Giter VIP logo

Comments (2)

majosm avatar majosm commented on July 23, 2024

While debugging axis tagging I've run into a couple of snags with zeros_like, etc. and wanted to mention them for discussion.

  1. In #229, we modified these functions to propagate both axes and tags. In retrospect, I'm not sure if tags should be propagated. For example, when using inducer/pytato#284, this caused the CreatedAt tag from the source array to be propagated to the new array of zeros, giving the impression that the array was created somewhere where it wasn't. I'm not terribly familiar with the other tags, but I'm wondering if it makes much sense to propagate those either?
  2. Another issue I ran into is that since the result of zeros_like does not explicitly depend on the incoming source array, AFAIK axes are not able to be inferred from this array. In the case of a simulation state initialization, where the computation being done might only depend on nodes (i.e., no grudge operators are used), removing the dependency on the source could cut off the only source of axis inferral for the new array. I don't have a clear idea of how to fix this, apart from using the old 0*array method. Thoughts?

cc @inducer, @kaushikcfd, @matthiasdiener

from arraycontext.

inducer avatar inducer commented on July 23, 2024

These are good questions. Thanks for raising them!

For your first question, a simple-but-perhaps-too-ad-hoc way of addressing the issue would be to tell tags (e.g. by being a subclass of PropagatableTag or so, with TBD semantics) whether they should propagate in inference and in situations like zeros_like. "Descriptive" tags definitely should propagate, but many others shouldn't. I'd welcome opinions on this.

The second one is thornier. 🤔 The problem, IIUC, is that information propagates from the "source" array to the "target" array only at the moment when zeros_like runs, but not after that. There's a menu of (bad?) options here for how to ensure information continues to propagate:

  • We could make a tag 🤦 to say so. A problem with this is that such a tag would hold a reference to another array, which would have to be replaced upon every DAG rewrite. I would guess that this would drive up the cost of DAG rewrites, because suddenly we have to go hunt for these arrays in the tags on every array we traverse.
  • We could make a less-bad version of 0*array. One way to do so would be a function zero(...) that returns zero no matter the input. (This would address the issue that 0*array propagates NaNs.) This would allow the connection from source to target to exist just long enough for tag propagation to work (with a definable axis mapping). Upon code generation, we might need to find a way to drop the spurious dependency edge.

None of these options are particularly lovely IMO. If there are better ideas, I'd be all ears.

from arraycontext.

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.