pymc-devs / pymc-devs/pytensor
Try to make pytensor compatible with the Python array API standard
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
Description
https://data-apis.org/array-api/latest/index.html
The standard considers lazy graph libraries so we should be fine. The only large difference I saw was that the .shape attribute should return a tuple of integers or None, whereas our variable.shape attribute returns a symbolic vector variable.
https://data-apis.org/array-api/latest/API_specification/generated/array_api.array.shape.html#shape
That would be equivalent to our variable.type.shape (static shape).
However they mention it is okay to return a custom type as long as it behaves like a tuple. Our shape does because you can iter/index/tuplify it just fine, so it may be fine?
It seems dangerous to change the behavior of .shape. Opened an issue: https://github.com/data-apis/array-api/issues/891
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
Read the Array API standard's shape specification and the linked data-apis issue first. Compare PyTensor's variable.shape behavior with variable.type.shape, then determine the compatibility scope and whether the existing custom shape behavior is acceptable. Done requires a documented decision and any agreed compatibility changes to be covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100