tf.layers.dense用法

2018年05月30日 19:09:58 o0haidee0o 阅读数:20426
 

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.

(后面懒得翻译了,有空再说吧,[微笑脸])

最新文章

  1. js/javascript format json(js/javascript 格式化json字符串)
  2. 多线程相关------临界区CriticalSection
  3. CI框架整合yar
  4. 首次创建maven项目的准备工作
  5. Construct Binary Tree from Inorder and Postorder Traversal
  6. Unity3D和OGRE资源管理机制
  7. [转载]bigtable 中文版
  8. 【Stage3D学习笔记续】真正的3D世界(五):粒子特效
  9. [hadoop]Cannot create directory /mdrill/tablelist/fact_seller_all_d. Name node is in safe mode.
  10. iOS网络编程笔记——GCDAsyncSocket使用
  11. openjduge 求简单表达式的值
  12. 20190211 模拟训练 A. 大猫咪
  13. C#使用Dotfuscator混淆代码的加密方法
  14. win7升级IE11后F12无法正常操作
  15. MSCRM中报表开发二:创建基于FetchXML报表
  16. tomcat中配置servlet.xml的JNDI或JDBC连接数据库【原】
  17. rdesktop 指定服务器的分频率
  18. 第三百八十五节,Django+Xadmin打造上线标准的在线教育平台—登录功能实现,回填数据以及错误提示html
  19. LeetCode 9 Palindrome Number(回文数字判断)
  20. Golang Redis操作

热门文章

  1. leetcode540
  2. 在windows、linux中开启nginx的Gzip压缩大大提高页面、图片加载速度<转>
  3. (已解决)搭建ssm框架时给springmvc传入对象传不进去,传单个字符串可以
  4. Oracle保留两位小数的函数
  5. 尚硅谷springboot学习9-配置文件值注入
  6. Mysql(MyISAM和InnoDB)及Btree和索引优化
  7. Python爬虫示例
  8. 一张图知道HTML5布局(图)
  9. 8.抽象类、接口和多态.md
  10. vc读取当前路径和读取配置ini文件