Skip to content

Allow use on 1d arrays #84

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 11 commits into from
Apr 25, 2025
Merged

Allow use on 1d arrays #84

merged 11 commits into from
Apr 25, 2025

Conversation

flying-sheep
Copy link
Member

@flying-sheep flying-sheep commented Apr 24, 2025

One thing we could do is making the assert_array_equals strict=True.

That’d require downcasting float64 to float32 in some cases though.

@flying-sheep flying-sheep changed the title Allow use on 0d arrays Allow use on 1d arrays Apr 24, 2025
Copy link

codecov bot commented Apr 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.95%. Comparing base (a1643f9) to head (6bcd3b7).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #84      +/-   ##
==========================================
+ Coverage   98.91%   98.95%   +0.03%     
==========================================
  Files          17       17              
  Lines         370      381      +11     
==========================================
+ Hits          366      377      +11     
  Misses          4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Copy link

codspeed-hq bot commented Apr 24, 2025

CodSpeed Performance Report

Merging #84 will improve performances by ×4

Comparing 0d (6bcd3b7) with main (a1643f9)

Summary

⚡ 18 improvements
✅ 106 untouched benchmarks
🆕 36 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 test_stats_benchmark[1d-all-numpy.ndarray-float32-is_constant] N/A 2.7 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-float32-mean] N/A 2.9 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-float32-mean_var] N/A 8.9 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-float32-sum] N/A 2.8 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-float64-is_constant] N/A 4.8 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-float64-mean] N/A 4.7 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-float64-mean_var] N/A 17.1 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-float64-sum] N/A 4.7 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-int32-is_constant] N/A 2.8 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-int32-mean] N/A 4.1 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-int32-mean_var] N/A 8.9 ms N/A
🆕 test_stats_benchmark[1d-all-numpy.ndarray-int32-sum] N/A 4.1 ms N/A
🆕 test_stats_benchmark[1d-all-scipy.sparse.csc_array-float32-is_constant] N/A 2.7 ms N/A
🆕 test_stats_benchmark[1d-all-scipy.sparse.csc_array-float32-mean] N/A 2.9 ms N/A
🆕 test_stats_benchmark[1d-all-scipy.sparse.csc_array-float32-mean_var] N/A 14.7 ms N/A
🆕 test_stats_benchmark[1d-all-scipy.sparse.csc_array-float32-sum] N/A 2.8 ms N/A
🆕 test_stats_benchmark[1d-all-scipy.sparse.csc_array-float64-is_constant] N/A 4.8 ms N/A
🆕 test_stats_benchmark[1d-all-scipy.sparse.csc_array-float64-mean] N/A 4.7 ms N/A
🆕 test_stats_benchmark[1d-all-scipy.sparse.csc_array-float64-mean_var] N/A 21.4 ms N/A
🆕 test_stats_benchmark[1d-all-scipy.sparse.csc_array-float64-sum] N/A 4.6 ms N/A
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

@flying-sheep flying-sheep added the run-gpu-ci Apply this label to run GPU CI once label Apr 24, 2025
@flying-sheep flying-sheep marked this pull request as ready for review April 24, 2025 15:44
@github-actions github-actions bot removed the run-gpu-ci Apply this label to run GPU CI once label Apr 24, 2025
@flying-sheep flying-sheep requested a review from ilan-gold April 24, 2025 16:25
Comment on lines +55 to +56
if axis is None:
return cast("np.number[Any]", x.data.sum(dtype=dtype))
Copy link
Member Author

Choose a reason for hiding this comment

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

without this, 1D csr_arrays sum up to np.float64 no matter if bool, int, or float32.

that’s not the case for 2D ones, so I should probably report this as an issue to scipy.

@flying-sheep flying-sheep added the run-gpu-ci Apply this label to run GPU CI once label Apr 24, 2025
@github-actions github-actions bot removed the run-gpu-ci Apply this label to run GPU CI once label Apr 24, 2025
@flying-sheep flying-sheep requested a review from ilan-gold April 25, 2025 12:17
@flying-sheep flying-sheep merged commit 4674372 into main Apr 25, 2025
16 of 17 checks passed
@flying-sheep flying-sheep deleted the 0d branch April 25, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants