pymc-devs / pymc-devs/pytensor
Dot and blas slowed by negative strides
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
Context for the issue:
Currently, cumulative sum is implemented as a wrapper for the corresponding Numpy function.
When testing with vectors, instead of using
pt.cumsum(x)
using
pt.dot(pt.tril(pt.ones((d,d))), x)
where d is the length of vector x, seems to lead to considerably faster sampling performance.
See this gist for a quick demo.
Proposal:
Keep the API un changed, but change the internals to compute the dot product with the lower diagonal matrix for the dimension specified in the axis argument of cumsum.
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 cumsum implementation and its handling of the axis argument, then compare it with the existing dot-based expression using a lower-triangular matrix. Check how the current implementation is tested and benchmark the proposed internals; done means preserving the unchanged cumsum API while confirming improved sampling performance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- numpy, python
- Domain
- backend, performance
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100