pymc-devs / pymc-devs/pytensor
Advanced(Inc)Subtensor text representation
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 644
- Forks
- 208
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 16
Description
Description
After #1756 Advanced and IncSubtensor take idx_list (just like Subtensor did). It would be nice to use the same string representation we used for Subtensor to make dprint more readable.
import pytensor.tensor as pt
x = pt.zeros((2, 3, 4, 5))
basic_sub = x[0, :, :1, 1]
basic_sub.dprint()
# Subtensor{i, :, :stop, j} [id A]
# ├─ Alloc [id B]
# │ ├─ 0.0 [id C]
# │ ├─ 2 [id D]
# │ ├─ 3 [id E]
# │ ├─ 4 [id F]
# │ └─ 5 [id G]
# ├─ 0 [id H]
# ├─ 1 [id I]
# └─ 1 [id J]
adv_sub = x[[0], :, :1, 1]
adv_sub.dprint()
# AdvancedSubtensor{idx_list=(0, slice(None, None, None), slice(None, 1, None), 2)} [id A]
# ├─ Alloc [id B]
# │ ├─ 0.0 [id C]
# │ ├─ 2 [id D]
# │ ├─ 3 [id E]
# │ ├─ 4 [id F]
# │ └─ 5 [id G]
# ├─ [0] [id H]
# ├─ TensorFromScalar [id I]
# │ └─ 1 [id J]
# └─ TensorFromScalar [id K]
# └─ 1 [id L]
(We should also check what's going on with those TensorFromScalar in AdvancedSubtensor...)
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 with the Subtensor, AdvancedSubtensor, and IncSubtensor entry points and compare their current string representations with the dprint examples in the issue. Check the AdvancedSubtensor TensorFromScalar output as noted; done means Advanced and IncSubtensor use the readable idx_list-style representation and the related output is understood.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- developer-experience
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100