You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Polygraphy rounds CPU float16 top-k index 2049 to 2048 #4976
Polygraphy reports an exact top-1 match for predictions with different winning classes, 2048 and 2049. This reproduces with FP16 scores on a CPU-only PyTorch installation.
I’d like to pick this up. As noted above, the CPU fallback appears to cast the indices back to FP16 along with the values. I’ll check that keeping the indices as integers fixes the 2049 case without changing the values’ dtype.
I confirmed the fix locally: the CPU fallback casts only the scores back to FP16 and leaves the indices as int64. The regression test now returns index 2049 instead of 2048, and the scores are still FP16. I ran the related CPU tests: 252 passed and 4 skipped. If this approach looks good to you, I’m happy to open a PR.
Activity
pk954061458 commentedon Nov 30, 2026
I’d like to pick this up. As noted above, the CPU fallback appears to cast the indices back to FP16 along with the values. I’ll check that keeping the indices as integers fixes the 2049 case without changing the values’ dtype.
pk954061458 commentedon Dec 1, 2026
I confirmed the fix locally: the CPU fallback casts only the scores back to FP16 and leaves the indices as int64. The regression test now returns index 2049 instead of 2048, and the scores are still FP16. I ran the related CPU tests: 252 passed and 4 skipped. If this approach looks good to you, I’m happy to open a PR.
ibondarenko1 commentedon Dec 1, 2026
Thanks for checking this. Getting index 2049 back with the scores still in FP16 is exactly what I expected. Please open the PR.