dims.Data creates XTensorSharedVariables#8096
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #8096 +/- ##
=======================================
Coverage 91.49% 91.50%
=======================================
Files 123 123
Lines 19832 19821 -11
=======================================
- Hits 18146 18137 -9
+ Misses 1686 1684 -2
🚀 New features to boost your workflow:
|
ba31b01 to
abfdd9e
Compare
abfdd9e to
04e2f24
Compare
dims.Data creates XTensorSharedVariables directly
dims.Data creates XTensorSharedVariables directlydims.Data creates XTensorSharedVariables
Documentation build overview
Show files changed (9 files in total): 📝 9 modified | ➕ 0 added | ➖ 0 deleted
|
jessegrabowski
left a comment
There was a problem hiding this comment.
approved with some stupid questions and a nitpick about a comment, typical PR review smh
| """ | ||
| model = modelcontext(model) | ||
| var = var.copy(model.name_for(name)) | ||
| var = view_op(var, name=model.name_for(name)) |
There was a problem hiding this comment.
What's the difference? Maybe a better question - why were we copying in the first place?
There was a problem hiding this comment.
You need an op sometimes because you can't have x be both a free rv and a deterministic, but x and view(x) is fine. Copy was another way of achieving this but it's Elemwise or XElemwise Op depending on the type. View instead works with any input type (and achieves the same).
Even variables without a .copy method would work in the future.
The immediate motivation for changing though was to keep pretending xtensorvariables don't exist as much as possible in the rest of the codebase
| coords = { | ||
| "group": range(3), | ||
| "knots": range(N_knots), | ||
| "knot": range(N_knots), |
There was a problem hiding this comment.
singular dims gang rise up!
9b06508 to
0a6f365
Compare
Depends on pymc-devs/pytensor#1882
We were registering regular TensorSharedVariables in
pymc.dims.Data, and then wrapping those inas_xtensor. The problem with that is that when you then try to act onm["x"]you were not acting on the same variable thatpymc.dims.Datareturned to you, instead you were acting on the input ofas_xtensor...This made it hard to adopt it in pymc-marketing