2
tf.float16和tf.bfloat16和https://www.tensorflow.org/versions/r0.12/api_docs/python/framework/tensor_types中列出的有什么不同?什么是tf.bfloat16“截断的16位浮点”?
另外,它们是什么意思的“量化整数”?
tf.float16和tf.bfloat16和https://www.tensorflow.org/versions/r0.12/api_docs/python/framework/tensor_types中列出的有什么不同?什么是tf.bfloat16“截断的16位浮点”?
另外,它们是什么意思的“量化整数”?
bfloat16
是一种特定于tensorflow的格式,其设计更易于从float32
转换。它与IEEE自己的float16
不同,因此是新名称。
从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。
谢谢。在源代码中还提到:“由于现有的IEEE float16类型,我们不会将其名称命名为”float16“,而只是使用”uint16“。” 为什么uint16?这可能是文档中的错误,它意味着要说bfloat16? – JMC
我认为他们只是指[内部表示bfloat16的方式](https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/framework/numeric_types.h#L49)。 – user1735003