Skip to content

Conversation

@jessegrabowski
Copy link
Member

@jessegrabowski jessegrabowski commented Oct 24, 2025

Description

Numba CumOp is passing the axis argument to np.cumsum and np.cumprod when ndim == 1, but the axis argument is not supported. Since there's only one dimension, we can just ignore it anyway, which this PR does.

Related Issue

Checklist

Type of change

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

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

@jessegrabowski jessegrabowski added bug Something isn't working numba labels Oct 24, 2025
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug in the Numba implementation of cumulative operations (CumOp) where the axis argument was incorrectly passed to NumPy's cumsum and cumprod functions for 1D inputs, causing an error since these functions don't support the axis parameter for 1D arrays in Numba.

Key changes:

  • Removed the axis argument from np.cumsum and np.cumprod calls when input is 1D
  • Added test coverage for 1D cumulative operations with explicit axis argument

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pytensor/link/numba/dispatch/extra_ops.py Removed axis parameter from np.cumsum and np.cumprod calls in 1D case
tests/link/numba/test_extra_ops.py Added test for 1D cumulative operations with axis=0 argument
@codecov
Copy link

codecov bot commented Oct 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.65%. Comparing base (17c675a) to head (01e3e2c).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@ Coverage Diff @@ ## main #1691 +/- ## ========================================== + Coverage 81.61% 81.65% +0.04%  ========================================== Files 242 244 +2 Lines 53537 53590 +53 Branches 9433 9438 +5 ========================================== + Hits 43695 43760 +65  + Misses 7366 7350 -16  - Partials 2476 2480 +4 
Files with missing lines Coverage Δ
pytensor/link/numba/dispatch/extra_ops.py 96.09% <100.00%> (+3.90%) ⬆️

... and 5 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 2948525 into pymc-devs:main Oct 27, 2025
58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working numba

2 participants