作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
https://www.tensorflow.org/versions/r0.12/api_docs/python/framework/tensor_types 中列出的 tf.float16 和 tf.bfloat16 之间有什么区别?
另外,“量化整数”是什么意思?
最佳答案
bfloat16
是一种 tensorflow 特定格式,与 IEEE 自己的 float16
不同,因此有了新名称。 b
代表 (Google) Brain。
基本上,bfloat16
是一个被截断为前 16 位的 float32
。因此它的指数有相同的 8 位,而尾数只有 7 位。因此,float32
之间的转换很容易,并且由于它与 float32
的范围基本相同,因此可以最大限度地降低出现 NaN
的风险s 或从 float32 切换时梯度爆炸/消失
。
来自sources :
// Compact 16-bit encoding of floating point numbers. This representation uses// 1 bit for the sign, 8 bits for the exponent and 7 bits for the mantissa. It// is assumed that floats are in IEEE 754 format so the representation is just// bits 16-31 of a single precision float.//// NOTE: The IEEE floating point standard defines a float16 format that// is different than this format (it has fewer bits of exponent and more// bits of mantissa). We don't use that format here because conversion// to/from 32-bit floats is more complex for that format, and the// conversion for this format is very simple.
对于量化整数,它们旨在替换经过训练的网络中的浮点以加快处理速度。基本上,它们是一种实数的定点编码,尽管其操作范围被选择来表示网络任何给定点的观察到的分布。
有关量化的更多信息 here .
关于tensorflow - 什么是 tf.bfloat16 "truncated 16-bit floating point"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44873802/
我是一名优秀的程序员,十分优秀!