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
reduce_sum over a short last axis after mul is wrong past 65536 elements #2906
reduce_sum(mul(x, y), axes=[-1]) comes back wrong once the tensor gets past 65536 elements and the last axis is short . mul on its own and reduce_sum on its own are both exact .
96 x 168 x 4 is 64512 elements and 98 x 168 x 4 is 65856 . the last axis matters : with 4 to 16 it goes wrong , with 2 or 3 it does not , and a last axis of 768 at 98304 elements is fine . add in place of mul goes wrong the same way , and the result is the same for every compute_units setting .
it reaches plain torch code too . (x * y).sum(-1) on a (1, 3, 128, 168, 4) tensor , converted with fp32 precision and run on the cpu , is off by 3.2 . with fp16 on all compute units it is fine .
macOS 26.5.2 (25F84) , apple m5 , coremltools main at a207b1a .
this is what broke the separable upsample lowering at image sizes . the pull request i am opening for the antialias resize works around it with a matmul .
Activity