tf.layers.dropout用法

dropout:一种防止神经网络过拟合的手段。

随机的拿掉网络中的部分神经元,从而减小对W权重的依赖,以达到减小过拟合的效果。

注意:dropout只能用在训练中,测试的时候不能dropout,要用完整的网络测试哦。

tf.layers.dropout(
    inputs,
    rate=0.5,
    noise_shape=None,
    seed=None,
    training=False,
    name=None
)
Arguments:
  • inputs: Tensor input.
  • rate: The dropout rate, between 0 and 1. E.g. "rate=0.1" would drop out 10% of input units.
  •             就是你在训练的时候想拿掉多少神经元,按比例计算。0就是没有dropout,1就是整个层都没了(会报错的)。
  • noise_shape: 1D tensor of type int32 representing the shape of the binary dropout mask that will be multiplied with the input. For instance, if your inputs have shape (batch_size, timesteps, features), and you want the dropout mask to be the same for all timesteps, you can use noise_shape=[batch_size, 1, features].
  • seed: A Python integer. Used to create random seeds. Seetf.set_random_seed for behavior.
  • training: Either a Python boolean, or a TensorFlow boolean scalar tensor (e.g. a placeholder). Whether to return the output in training mode (apply dropout) or in inference mode (return the input untouched).
  • name: The name of the layer (string).

  • 9
    点赞
  • 36
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值