tensorflow: what's the difference between tf.nn.dropout and tf.layers.dropout

前端 未结 4 1995
面向向阳花
面向向阳花 2021-02-01 05:34

I\'m quite confused about whether to use tf.nn.dropout or tf.layers.dropout.

many MNIST CNN examples seems to use tf.nn.droput, with keep_prop as one of params.

4条回答
  •  感动是毒
    2021-02-01 05:51

    On the training phase they are identical (as long as "drop rate" and "keep rate" are consistent). However, for evaluation (test) phase they are completely different. tf.nn.dropout will still do random dropping while tf.layers.dropout won't drop anything (transparent layer). In most cases it make sense to use tf.layers.dropout.

提交回复
热议问题