Skip to content

Fix coords/dims guidance: mutable by default, shape never needed#41

Merged
twiecki merged 2 commits intomainfrom
fix-coords-mutable-guidance
Mar 12, 2026
Merged

Fix coords/dims guidance: mutable by default, shape never needed#41
twiecki merged 2 commits intomainfrom
fix-coords-mutable-guidance

Conversation

@twiecki
Copy link
Copy Markdown
Collaborator

@twiecki twiecki commented Mar 11, 2026

Summary\n- Remove misleading mutable=True guidance — coords and pm.Data are mutable by default in PyMC, so the old subsection was a useless distraction\n- Add freeze_dims_and_data — mention that this can be used to freeze existing mutable coords and data, which may simplify graphs or generate more efficient code\n- Replace "prefer dims, fall back to shape" with "always use dims, never shape" — shape is never needed\n\nPer feedback from <@287659028241448961>.\n\n🤖 Generated with Claude Code

…er needed

- Remove misleading mutable=True guidance (coords and pm.Data are mutable by default)
- Add freeze_dims_and_data for when you want to freeze mutable coords/data
- Replace "prefer dims, fall back to shape" with "always use dims, never shape"

Co-Authored-By: Claude <noreply@anthropic.com>
@ricardoV94
Copy link
Copy Markdown
Collaborator

that's not the syntax (there is no model.freeze_dims_and_data). Still mentioning NOT passing mutable=True, which is imo just a waste of context.

Per Ricardo's feedback:
- model.freeze_dims_and_data() does not exist; use the standalone
  function from pymc.model.transform.optimization instead
- Remove 'Coords and Data are mutable by default' section -- mentioning
  mutable=True at all is a waste of context

Co-Authored-By: Claude <noreply@anthropic.com>
@twiecki
Copy link
Copy Markdown
Collaborator Author

twiecki commented Mar 12, 2026

Fixed in b19585f:

  • model.freeze_dims_and_data() → standalone function freeze_dims_and_data(model) imported from pymc.model.transform.optimization (matches how benchmark.py already uses it)
  • Removed the entire "Coords and Data are mutable by default" section — no more mentions of mutable=True

@twiecki twiecki merged commit 660a9ff into main Mar 12, 2026
0 of 3 checks passed
@twiecki twiecki deleted the fix-coords-mutable-guidance branch March 12, 2026 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants