Comments (2)
While debugging axis tagging I've run into a couple of snags with zeros_like
, etc. and wanted to mention them for discussion.
- In #229, we modified these functions to propagate both
axes
andtags
. In retrospect, I'm not sure iftags
should be propagated. For example, when using inducer/pytato#284, this caused theCreatedAt
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? - 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 onnodes
(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 old0*array
method. Thoughts?
cc @inducer, @kaushikcfd, @matthiasdiener
from arraycontext.
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 functionzero(...)
that returns zero no matter the input. (This would address the issue that0*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)
- Handling temperature initial guesses
- Deprecate `is_array_container` HOT 7
- CI failing in mypy HOT 1
- `actx.compile` for pytato should allow things that are not array containers HOT 2
- Dealing with constants in `freeze`
- `arraycontext.container.to_numpy` semantics HOT 8
- Issues with `zeros` et al functions of array contexts HOT 4
- Make it so array containers do not know their array context? HOT 8
- Make a way to ensure we always use the actx's allocator
- Regression: "Out of host memory" on Nvidia ICD HOT 4
- Exposing `np.select`? HOT 1
- Function outlining errors in mirgecom
- Add optional `allow_single_version` Boolean arg to `actx.compile` HOT 12
- Precision: What actually do `freeze`/`thaw` mean?
- `test_array_context_np_workalike` may be flaky
- Introduce a `-O0` mode to avoid full-blast code transformation for code that runs once
- Loopy a hard dependency? HOT 1
- eager arraycontext bug
- Renaming parts of partitioned DAGs HOT 2
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 arraycontext.