TensorType.shape is a mutable plain attribute
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
- Issue type
- Refactor
- Clarity
- Clearly specified
- Activity status
- Quiet
- Tech stack
- python
- Domain
- machine-learning
Research direction
Start by locating the Python definition of TensorType and compare its shape handling with XTensorType. Add or update the relevant test so assigning to shape raises AttributeError, then run that focused test to confirm the attribute is read-only.
Written by the indexing model from the issue text.
Description
Reproduction
import pytensor.tensor as pt
x = pt.scalar("x")
x.type.shape = (3,)
Expected behavior
shape should be a read-only property. Mutating it should raise AttributeError.
Actual behavior
shape is a plain instance attribute. Unlike XTensorType, TensorType has no derived attribute that goes out of sync when shape changes, so no observable corruption occurs. This is a consistency issue rather than a bug.
Environment
pytensor 3.2.4
- Dominant language
- Python
- Stars
- 644
- Forks
- 209
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pymc-devs/pytensor
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug indexing mlx
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
graph rewriting linalg performance
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
bug torch
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
All issues in pymc-devs/pytensor
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100