pymc-devs / pymc-devs/pytensor
`SpecifyShape` should eagerly raise an error when static shapes disagree
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
Description
This came up in #885. The following graph will raise at compile time, but not during graph construction:
x = tensor("x", shape=(None, 5, 3))
# We avoid the helper specify_shape that optimizes some (but not all) cases eagerly
ss = SpecifyShape()
out = ss(x, None, 5, 4)
This should just raise immediately, since x has a static shape 3 on the 3rd dimension, and we're trying to specify a shape of 4.
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.
Research direction
Start by locating the SpecifyShape operator and reproduce the example using tensor("x", shape=(None, 5, 3)) with a requested shape of (None, 5, 4). Done means the static mismatch raises during graph construction instead of only at compile time, with coverage for this case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100