Skip to content

Convert batches to float on GPU (inherited from PR 255) - #259

Merged
agentmorris merged 3 commits into
mainfrom
int-conversion
Oct 17, 2026
Merged

agentmorris merged 3 commits into
mainfrom
int-conversion

Conversation

@agentmorris

Copy link
Copy Markdown
Owner

No description provided.

putdanil and others added 3 commits October 17, 2026 11:58
PTDetector._process_batch_group() converted each batch to float32 and divided
by 255 on the CPU, then copied it to the GPU.  On CUDA devices, the uint8
tensor is now copied first: 4x fewer bytes, and a pass over every pixel moves
off the CPU.  The division uses a 0-dim tensor on the device rather than a
Python float, because CUDA computes x / scalar as x * (1 / scalar), which
differs from the CPU result in the last bit for 126 of the 256 pixel values;
dividing by a device tensor gives exactly the CPU's float32 values.  Other
devices keep the existing code path.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@agentmorris
agentmorris merged commit a289acb into main Oct 17, 2026
20 checks passed
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