张量流中的 DropoutWrapper 和测试时间缩放
DropoutWrapper in tensorflow and test time scaling
我在 CS231n class 中了解到,在测试期间,我们需要通过用作训练丢失概率的相同因子来缩放激活。在 tensorflow 中使用 DropoutWrapper 时,我没有看到任何允许我进行此测试时间缩放的参数。
为什么不见了? RNN 有必要吗?正确的做法是什么?
您不需要在推理上进行缩放,因为 tf.nn.dropout
在训练时应用缩放(从 tf.nn.dropout documentation 开始):
With probability keep_prob
, outputs the input element scaled up by 1 / keep_prob
, otherwise outputs 0
. The scaling is so that the expected sum is unchanged.
我在 CS231n class 中了解到,在测试期间,我们需要通过用作训练丢失概率的相同因子来缩放激活。在 tensorflow 中使用 DropoutWrapper 时,我没有看到任何允许我进行此测试时间缩放的参数。
为什么不见了? RNN 有必要吗?正确的做法是什么?
您不需要在推理上进行缩放,因为 tf.nn.dropout
在训练时应用缩放(从 tf.nn.dropout documentation 开始):
With probability
keep_prob
, outputs the input element scaled up by1 / keep_prob
, otherwise outputs0
. The scaling is so that the expected sum is unchanged.