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

前端 未结 4 1986
面向向阳花
面向向阳花 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 06:04

    Apart from the answers from @nikpod and @Salvador Dali

    The tf.nn.dropout scaled the weights by 1./keep prob during training phase, while tf.layers.dropout scaled the weights by 1./(1-rate).

    During evaluation, You could set the keep prob to 1 which is equivalent to set training to false.

提交回复
热议问题