Skip to content

Move weight to the metric device in BinaryAUROC and BinaryNormalizedEntropy update - #239

Open
davrens101 wants to merge 1 commit into
meta-pytorch:mainfrom
davrens101:fix-weight-device-auroc-bne
Open

davrens101 wants to merge 1 commit into
meta-pytorch:mainfrom
davrens101:fix-weight-device-auroc-bne

Conversation

@davrens101

@davrens101 davrens101 commented Nov 12, 2026 •

Copy link
Copy Markdown

Summary:
BinaryAUROC.update moves input and target to self.device but not weight, so a metric on CUDA with a CUDA weight (or any weight on another device) hits a device mismatch at compute() / on torch.cat of states. BinaryNormalizedEntropy.update has the same omission. This moves weight to self.device in both.

Test plan:
Added regression tests using the meta device as a stand-in for CUDA (no GPU on my machine): test_binary_auroc_class_weight_moved_to_metric_device and test_ne_weight_moved_to_metric_device. Before the fix the BNE case raises Tensor on device cpu is not on the expected device meta!; after, both pass. The pre-existing distributed (RendezvousConnectionError) tests fail on my Windows machine both with and without this change; I could not run them.

I did not test on a real CUDA device. This PR was prepared with AI assistance (Claude Code); the change and tests were run locally. I supervised and checked the AI-assisted work as it progressed.

Fixes #224

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 12, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect device handling in weights in BinaryAUROC

1 participant