float32 指“32 位浮点数”数据类型,通常对应 IEEE 754 单精度浮点格式,用于在计算机中表示带小数的数值(在精度与内存占用之间折中)。常见于编程语言、数值计算、机器学习与图形处理等场景。(在不同语言/平台中也可能有别名,如 single。)
/ˈfloʊt ˌθɜːrtiˈtuː/
I stored the result as a float32 to save memory.
我把结果存成 float32 来节省内存。
When training the model, using float32 can speed up computation, but it may introduce small rounding errors compared with float64.
训练模型时,使用 float32 可能加快计算速度,但与 float64 相比可能引入轻微的舍入误差。
float32 由 float(浮点数,floating-point 的简称)+ 32(表示位数)组合而来,字面意思就是“32 位的浮点表示”。在很多系统中它指向 IEEE 754 的 single-precision 格式:用 32 个二进制位来编码一个近似的实数。