pymc-devs / pymc-devs/pytensor

Delete `extra_ops.py`, replace with specialized files with more informative names

Open
#959 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

maintenance request discussion
Dominant language
Python
Stars
644
Forks
208
Avg merge
2d 14h
Merged PRs (30d)
16

Description

Description

One might be indexing.py or index_tricks.py. That could hold anything related to generating indices or masks (including the new _delta and _iota functions introduced in #722.

There could also be a file called makers.py to hold ops like pt.linspace that make a useful tensor. pt.arange kind of straddles between an index and a tensor used in actual computation, so we could have a big debate about where it could go!

Other themes from stuff in extra ops:

  • cumulative ops -- these should probably be in basic? Or a file for ops that operate on axes (cum, diff, unique)
  • sorting related (sort, searchsorted, binsort) could be in a sort.py
  • Several functions related to broadcasting -- broadcasting.py?
  • Shape related - ravel, unravel, squeeze
  • Fill diag/off-diag sort of falls under the umbrella of indexing if you think about it. But it probably belongs wherever Alloc is defined?
  • Real grab-bag functions: CpuContiguous (is this used anywhere?), Bartlett (windowing function -- is this a refugee from the deleted signal.py?)

Needs some thought, obviously these are just some ideas to start a discussion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing extra_ops.py and the proposed groupings: indexing.py or index_tricks.py, makers.py, sort.py, broadcasting.py, and the existing basic area. Consider where cumulative, shape, diagonal, windowing, and contiguous operations belong, then define the specialized file layout and remove extra_ops.py once all operations have an agreed home.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.