tensorflow - 为什么relu6中是6?

标签 tensorflow

我在 R 中从头开始破解了一个深度前馈神经网络,它似乎比 ReLU 更稳定,具有“硬 sigmoid”激活 - max(0,min(1,x))。尝试将其移植到 TensorFlow 中,发现他们没有内置此激活函数,只有 relu6,它使用上限为 6。这有什么原因吗? (我知道你可以做 relu6(x*6)/6,但如果 TF 的家伙把 6 放在那里有充分的理由,我想知道。) 另外,我想知道其他人是否在前馈网络中遇到 ReLU 爆炸问题(我知道 RNN 问题)。

最佳答案

来自this reddit thread :

This is useful in making the networks ready for fixed-point inference. If you unbound the upper limit, you lose too many bits to the Q part of a Q.f number. Keeping the ReLUs bounded by 6 will let them take a max of 3 bits (upto 8) leaving 4/5 bits for .f

看来,6 只是根据您希望能够将网络的训练参数压缩到的位数而选择的任意值。 根据“为什么”仅实现值为 6 的版本,我认为这是因为该值最适合 8 位,这可能是最常见的用例。

关于tensorflow - 为什么relu6中是6?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47220595/

相关文章:

python - Keras : AttributeError: 'int' object has no attribute 'ndim' when using model. 适合

java - 如何从 tflite 模型输出形状 [1, 28, 28,1] 的数组作为 android 中的图像

tensorflow - 在 Tensorflow 2 中分层批处理

python - 将 tensorflow.contrib 与 cv_bridge 一起使用会导致 tcmalloc 错误

python - 用我自己的数据进行tensorflow对象检测,你能帮我吗?

python - 如何将 py_func 与返回 dict 的函数一起使用

python-3.x - 无法将 tensorflow 模型转换为 tflite

python - 为什么第一个卷积层权重在训练过程中不改变?

java - Python 中的 Tensorflow Java Api `toGraphDef` 等价物是什么?

python - 如何在keras中将回归输出限制在0到1之间