Skip to content

fix dense int input#718

Merged
Intron7 merged 5 commits into
mainfrom
promote-int-to-float
Jul 6, 2026
Merged

fix dense int input#718
Intron7 merged 5 commits into
mainfrom
promote-int-to-float

Conversation

@Intron7

@Intron7 Intron7 commented Jul 6, 2026

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Bug Fixes

    • Integer-valued dense inputs are now automatically converted to floating point for normalization and scaling, preventing dtype-related issues and improving result consistency.
    • Normalization now preserves expected totals after conversion, and scaling produces correctly centered and scaled output for integer inputs.
  • Tests

    • Added coverage for dense integer input handling in normalization and scaling.

Intron7 added 2 commits July 6, 2026 12:59
Signed-off-by: Intron7 <severin.dicks@icloud.com>
Signed-off-by: Intron7 <severin.dicks@icloud.com>
@codecov-commenter

codecov-commenter commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.31%. Comparing base (481c60c) to head (383b239).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #718   +/-   ##
=======================================
  Coverage   90.31%   90.31%           
=======================================
  Files         106      106           
  Lines        9581     9585    +4     
=======================================
+ Hits         8653     8657    +4     
  Misses        928      928           
Files with missing lines Coverage Δ
src/rapids_singlecell/preprocessing/_normalize.py 89.13% <100.00%> (+0.09%) ⬆️
src/rapids_singlecell/preprocessing/_scale.py 91.71% <100.00%> (+0.09%) ⬆️

@Intron7 Intron7 enabled auto-merge (squash) July 6, 2026 12:11
@Intron7 Intron7 disabled auto-merge July 6, 2026 12:20
@Intron7 Intron7 merged commit af5a851 into main Jul 6, 2026
6 of 7 checks passed
@Intron7 Intron7 deleted the promote-int-to-float branch July 6, 2026 12:20
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 760e2e58-7fe9-4ad2-b40c-5ffb3de10a7e

📥 Commits

Reviewing files that changed from the base of the PR and between 908e02b and b931f0d.

📒 Files selected for processing (5)
  • docs/release-notes/0.16.0.md
  • src/rapids_singlecell/preprocessing/_normalize.py
  • src/rapids_singlecell/preprocessing/_scale.py
  • tests/test_normalization.py
  • tests/test_scaling.py

📝 Walkthrough

Walkthrough

This PR modifies normalize_total and _scale_dispatch to detect integer-dtype dense inputs and cast them to floating point (cp.float32 and cp.float64 respectively) before processing. Corresponding tests and a release-note entry were added.

Changes

Dense integer promotion

Layer / File(s) Summary
normalize_total integer cast
src/rapids_singlecell/preprocessing/_normalize.py, tests/test_normalization.py
Integer X is cast to cp.float32 before normalization, skipping the prior conditional copy in that path; a new test verifies dtype promotion and correct row sums.
scale integer cast
src/rapids_singlecell/preprocessing/_scale.py, tests/test_scaling.py
_scale_dispatch upcasts integer X to cp.float64 before backend dispatch; a new parametrized test verifies dtype promotion and centered output.
Release notes
docs/release-notes/0.16.0.md
A bug-fix bullet documents the promotion of dense integer inputs to floating point for both functions.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

Not applicable — changes are localized dtype-check additions without multi-component interaction flows.

Suggested reviewers: Intramuros, flying-sheep

Poem
A rabbit hopped through code so neat,
found ints where floats should meet,
cast them up to float32, float64 too,
now sums add right, as they should do,
a tidy patch, a release note complete. 🐇

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch promote-int-to-float

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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