Skip to content

Conversation

PabloRoque
Copy link
Contributor

@PabloRoque PabloRoque commented Jul 8, 2025

Description

Converts negative constant axis to positive if present in Join(COp)

DISCLAIMER: Completely vibe coded in Claude Sonnet 3.7. May well be complete non-sense, and if so please close immediately.

Related Issue

Checklist

Type of change

  • New feature / enhancement
  • Bug fix
  • Documentation
  • Maintenance
  • Other (please specify):

@PabloRoque PabloRoque changed the title Vibe coding #1505 Converts negative constant axis to positive if present in Join(COp) Jul 8, 2025
Comment on lines 2191 to 2200
assert isinstance(
s.owner.outputs[0].owner.op, Join
), "Expected output node to be a Join op"

assert isinstance(
s.owner.inputs[0], ptb.Constant
), "Expected axis to be a Constant"
assert (
s.owner.inputs[0].data == 1
), f"Expected axis to be normalized to 1, got {s.owner.inputs[0].data}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: Convert this to be a single assert, and get rid of the failure messages it's easier to just read the code. Same below

Copy link
Member

@ricardoV94 ricardoV94 Jul 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or just do assert equal_computations([join(-1, a, b)], [join(1, a, b)]) which is perhaps more readable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much cleaner. Added this and removed the verbose tests

@ricardoV94
Copy link
Member

ricardoV94 commented Jul 8, 2025

The remaining comment is a nitpick, up to you whether you address them. Thanks, and to be clear I'm just shitting on LLM's being crazy verbose, the code changes and initiative are great.

I suggest you don't let them drive the tests, from experience they are ridiculous redundant / verbose, or don't actually test anything.

@PabloRoque
Copy link
Contributor Author

Thanks Ricardo. I agree they are really verbose.
On the positive side they enable newbies like me to start poking around.

Thanks for taking the time to teach me around, appreciate it.

Copy link

codecov bot commented Jul 8, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.04%. Comparing base (ae38884) to head (1071abc).
⚠️ Report is 116 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #1527   +/-   ##
=======================================
  Coverage   82.04%   82.04%           
=======================================
  Files         231      230    -1     
  Lines       52364    52352   -12     
  Branches     9217     9214    -3     
=======================================
- Hits        42962    42953    -9     
- Misses       7094     7095    +1     
+ Partials     2308     2304    -4     
Files with missing lines Coverage Δ
pytensor/tensor/basic.py 91.72% <100.00%> (+0.02%) ⬆️

... and 10 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ricardoV94 ricardoV94 merged commit 68d8dc7 into pymc-devs:main Jul 8, 2025
73 checks passed
@PabloRoque PabloRoque deleted the join-negative-axis branch August 30, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Join with constant axis doesn't get canonicalized

2 participants