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