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.

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

tf.layers.dense()的更多相关文章

  1. 对抗生成网络-图像卷积-mnist数据生成(代码) 1.tf.layers.conv2d(卷积操作) 2.tf.layers.conv2d_transpose(反卷积操作) 3.tf.layers.batch_normalize(归一化操作) 4.tf.maximum(用于lrelu) 5.tf.train_variable(训练中所有参数) 6.np.random.uniform(生成正态数据

    1. tf.layers.conv2d(input, filter, kernel_size, stride, padding) # 进行卷积操作 参数说明:input输入数据, filter特征图的 ...

  2. Tensorflow BatchNormalization详解:3_使用tf.layers高级函数来构建带有BatchNormalization的神经网络

    Batch Normalization: 使用tf.layers高级函数来构建带有Batch Normalization的神经网络 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 吴 ...

  3. Tensorflow BatchNormalization详解:2_使用tf.layers高级函数来构建神经网络

    Batch Normalization: 使用tf.layers高级函数来构建神经网络 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 吴恩达deeplearningai课程 课程笔 ...

  4. Tensorflow学习笔记(2):tf.nn.dropout 与 tf.layers.dropout

    A quick glance through tensorflow/python/layers/core.py and tensorflow/python/ops/nn_ops.pyreveals t ...

  5. tensorflow 一维卷积 tf.layers.conv1()使用

    在自然语言处理中,主要使用一维的卷积. API tf.layers.conv1d( inputs, filters, kernel_size, strides=1, padding='valid', ...

  6. TF中conv2d和kernel_initializer方法

    conv2d中的padding 在使用TF搭建CNN的过程中,卷积的操作如下 convolution = tf.nn.conv2d(X, filters, strides=[1,2,2,1], pad ...

  7. 图融合之加载子图:Tensorflow.contrib.slim与tf.train.Saver之坑

    import tensorflow as tf import tensorflow.contrib.slim as slim import rawpy import numpy as np impor ...

  8. tensorflow 1.0 学习:池化层(pooling)和全连接层(dense)

    池化层定义在 tensorflow/python/layers/pooling.py. 有最大值池化和均值池化. 1.tf.layers.max_pooling2d max_pooling2d( in ...

  9. Tensorflow BatchNormalization详解:4_使用tf.nn.batch_normalization函数实现Batch Normalization操作

    使用tf.nn.batch_normalization函数实现Batch Normalization操作 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 吴恩达deeplearnin ...

随机推荐

  1. django之Model类

    Model是model的基类,该类的metaclass是modelbase,在生成model类对象时是采用modelbase的.django.setup()时,apps会把app建立app_confi ...

  2. JsonConvert

    ///"{'jsonParam' : " + jsonText + "}" /* Dictionary<string, object> tmp = ...

  3. elasticSearch-header

    elasticSearch既有chrome的插件 sense,但是因为chrome作为恶意插件不让植入,因此sense目前还停留在5版本. elasticSearch自带head plugin,用于监 ...

  4. Net操作Excel_NPOI

    Npoi 简介 1.整个Excel表格叫做工作表:WorkBook(工作薄),包含的叫页(工作表):Sheet:行:Row:单元格Cell. 2.Npoi 下载地址:http://npoi.codep ...

  5. Matplotlib中文乱码问题

    一.找到并修改matplotlibrc文件 进入Python安装目录下的Lib\site-packages\matplotlib\mpl-data目录,用记事本打开matplotlibrc文件:找到f ...

  6. 如何在Windows下安装MYSQL,并截图说明

    说明 : window 下安装 mysql 虽然简单,但是细节不注意就会安装失败,特别是配置服务器时,Current Root Password:为空:如果输入密码了在后面安装会报错.(不知道设置这个 ...

  7. ReultSet有什么作用和使用

    结果集(ResultSet)是数据中查询结果返回的一种对象,可以说结果集是一个存储查询结果的对象,但是结果集并不仅仅具有存储的功能,他同时还具有操纵数据的功能,可能完成对数据的更新等. int col ...

  8. Ajax与select标签的组合运用

    ---------------------------------------------------------------------------------------------------- ...

  9. Unity AssetBundle

    Unity AssetBundle爬坑手记 - 夜阑卧听风吹雨 时间 2014-09-15 16:55:00  博客园精华区原文  http://www.cnblogs.com/ybgame/p/39 ...

  10. 2017面向对象程序设计(JAVA)第3周学习指导及要求(2017.9.6-2017.9.12)

    学习目标 掌握类与对象的基础概念,理解类与对象的关系: 掌握对象与对象变量的关系: 掌握预定义类的基本使用方法,熟悉Math类.String类.math类.Scanner类.LocalDate类的常用 ...