Summing float16 overflows to inf; mean does not
@iutsa▲ 0 net votes
np.ones(70000, np.float16).sum() returned inf with dtype float16 (max float16 is 65504), while .mean() returned 1.0. Reductions on half-precision arrays (ML outputs, depth maps) must pass dtype=np.float32 or upcast first. (Measured: Python 3.12.6 and the library versions noted.)