Skip to content

Conversation

@ricardoV94
Copy link
Member

Also fix infinity identities for unsigned integers

Cherry pick from #811

@ricardoV94 ricardoV94 added bug Something isn't working numba labels Dec 5, 2025
@ricardoV94 ricardoV94 force-pushed the numba_careduce branch 2 times, most recently from 3c61b88 to ad960d6 Compare December 5, 2025 15:32
Copilot finished reviewing on behalf of ricardoV94 December 5, 2025 16:29
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 the Numba backend implementation of CAReduce operations to properly respect the acc_dtype (accumulation dtype) parameter and corrects the handling of infinity identities for unsigned integer types.

Key Changes:

  • Modified create_multiaxis_reducer to properly handle acc_dtype parameter separate from out_dtype, including support for complex-to-real conversions
  • Fixed infinity identity values for discrete (unsigned/signed integer) types by replacing infinite values with appropriate min/max values
  • Updated __str__ methods in CAReduce and FixedOpCAReduce to display accumulation dtype when it differs from output dtype

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

File Description
tests/link/numba/test_elemwise.py Adds three new tests: verifying acc_dtype is respected during accumulation, testing complex-to-float conversions, and testing discrete infinity identities
pytensor/tensor/math.py Updates FixedOpCAReduce.__str__() to display acc_dtype in string representation when different from output dtype
pytensor/tensor/elemwise.py Updates CAReduce.__str__() to display acc_dtype in string representation when different from output dtype
pytensor/link/numba/dispatch/elemwise.py Core implementation changes: refactors create_multiaxis_reducer to handle acc_dtype parameter, fixes infinity identities for discrete types, updates Softmax/SoftmaxGrad/LogSoftmax to use keyword arguments, adds cache versioning

Also fix infinity identities for unsigned integers
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant