Skip to content

Speedup scalar Op python implementations #1169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Feb 12, 2025

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Jan 23, 2025

Some cleanup of unused code in scalar/math.py.

Also speedup a bit the perform method by avoiding allocating intermediate variables and attribute acces for a helper function


📚 Documentation preview 📚: https://pytensor--1169.org.readthedocs.build/en/1169/

@ricardoV94 ricardoV94 force-pushed the scalar_op_cleanup branch 2 times, most recently from f8abadb to 866f488 Compare January 24, 2025 08:21
Copy link

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 53.33333% with 21 lines in your changes missing coverage. Please review.

Project coverage is 82.26%. Comparing base (4fa9bb8) to head (5d340e2).
Report is 184 commits behind head on main.

Files with missing lines Patch % Lines
pytensor/scalar/math.py 37.50% 20 Missing ⚠️
pytensor/scalar/basic.py 88.88% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1169      +/-   ##
==========================================
- Coverage   82.27%   82.26%   -0.01%     
==========================================
  Files         186      186              
  Lines       48066    47962     -104     
  Branches     8633     8630       -3     
==========================================
- Hits        39546    39456      -90     
+ Misses       6360     6347      -13     
+ Partials     2160     2159       -1     
Files with missing lines Coverage Δ
pytensor/tensor/inplace.py 100.00% <ø> (ø)
pytensor/tensor/math.py 91.87% <100.00%> (+<0.01%) ⬆️
pytensor/tensor/xlogx.py 78.37% <100.00%> (-3.02%) ⬇️
pytensor/scalar/basic.py 80.59% <88.88%> (+0.04%) ⬆️
pytensor/scalar/math.py 87.76% <37.50%> (+0.65%) ⬆️

... and 2 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 requested a review from Armavica January 24, 2025 08:56
@ricardoV94 ricardoV94 marked this pull request as ready for review January 24, 2025 08:56
@Armavica
Copy link
Member

Looks good, but there are two more st_impl in pytensor/tensor/xlogx.py: worth removing them too in this PR?

@ricardoV94
Copy link
Member Author

definitely, missed those

@ricardoV94 ricardoV94 marked this pull request as draft January 24, 2025 16:36
@ricardoV94 ricardoV94 force-pushed the scalar_op_cleanup branch 2 times, most recently from 289067c to e4547cd Compare January 30, 2025 09:04
@ricardoV94 ricardoV94 requested a review from Armavica January 30, 2025 09:04
@ricardoV94 ricardoV94 marked this pull request as ready for review January 30, 2025 09:04
@ricardoV94 ricardoV94 changed the title Scalar op cleanup Speedup scalar Op python implementations Jan 30, 2025
@ricardoV94
Copy link
Member Author

ricardoV94 commented Feb 12, 2025

I removed the Chi2SF Scalar Op altogether. There is a tensor helper that still works with a future warning to just use gammaincc instead. This is not a standard scipy special function, and it doesn't make sense to support a redundant Op. It didn't even have gradients, where gammaincc does.

@ricardoV94 ricardoV94 merged commit 7411a08 into pymc-devs:main Feb 12, 2025
63 of 64 checks passed
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.

2 participants