zoukankan      html  css  js  c++  java
  • tf.layers.dense()

    tf.layers.dense用法

    dense:全连接层

    相当于添加一个层,即初学的add_layer()函数

    1.  
      tf.layers.dense(
    2.  
          inputs,
    3.  
          units,
    4.  
          activation=None,
    5.  
          use_bias=True,
    6.  
          kernel_initializer=None,
    7.  
          bias_initializer=tf.zeros_initializer(),
    8.  
          kernel_regularizer=None,
    9.  
          bias_regularizer=None,
    10.  
          activity_regularizer=None,
    11.  
          kernel_constraint=None,
    12.  
          bias_constraint=None,
    13.  
          trainable=True,
    14.  
          name=None,
    15.  
          reuse=None
    16.  
      )

    其中:

            inputs: 该层的输入

            units: 输出的大小(维数),整数或long

            activation: 使用什么激活函数(神经网络的非线性层),默认为None,不使用激活函数

            use_bias: 使用bias为True(默认使用),不用bias改成False即可

    • kernel_initializer: Initializer function for the weight matrix. If None(default), weights are initialized using the default initializer used by tf.get_variable.
    • bias_initializer: Initializer function for the bias.
    • kernel_regularizer: Regularizer function for the weight matrix.
    • bias_regularizer: Regularizer function for the bias.
    • activity_regularizer: Regularizer function for the output.
    • kernel_constraint: An optional projection function to be applied to the kernel after being updated by an Optimizer (e.g. used to implement norm constraints or value constraints for layer weights). The function must take as input the unprojected variable and must return the projected variable (which must have the same shape). Constraints are not safe to use when doing asynchronous distributed training.
    • bias_constraint: An optional projection function to be applied to the bias after being updated by an Optimizer.
    • trainable: Boolean, if True also add variables to the graph collectionGraphKeys.TRAINABLE_VARIABLES (see tf.Variable).
    • name: String, the name of the layer.
    • reuse: Boolean, whether to reuse the weights of a previous layer by the same name.
    (后面懒得翻译了,有空再说吧,[微笑脸])
    萍水相逢逢萍水,浮萍之水水浮萍!
  • 相关阅读:
    JavaScript获取数组索引
    jQuery实现购物车效果
    JavaScript随机验证码
    javascript头像上传
    JavaScript中null和undefined的区别
    cookie、sessionStorage和localStorage区别
    Cookie封装
    封装好的Ajax
    通过反射实现javaweb项目中权限的刷新
    java中反射的理解
  • 原文地址:https://www.cnblogs.com/AIBigTruth/p/10504213.html
Copyright © 2011-2022 走看看