tf.layers.dense()
tf.layers.dense用法
dense:全连接层
相当于添加一个层,即初学的add_layer()函数
tf.layers.dense(
inputs,
units,
activation=None,
use_bias=True,
kernel_initializer=None,
bias_initializer=tf.zeros_initializer(),
kernel_regularizer=None,
bias_regularizer=None,
activity_regularizer=None,
kernel_constraint=None,
bias_constraint=None,
trainable=True,
name=None,
reuse=None
)
其中:
inputs: 该层的输入
units: 输出的大小(维数),整数或long
activation: 使用什么激活函数(神经网络的非线性层),默认为None,不使用激活函数
use_bias: 使用bias为True(默认使用),不用bias改成False即可
kernel_initializer
: Initializer function for the weight matrix. IfNone
(default), weights are initialized using the default initializer used bytf.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 anOptimizer
(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 anOptimizer
.trainable
: Boolean, ifTrue
also add variables to the graph collectionGraphKeys.TRAINABLE_VARIABLES
(seetf.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()的更多相关文章
- 对抗生成网络-图像卷积-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特征图的 ...
- Tensorflow BatchNormalization详解:3_使用tf.layers高级函数来构建带有BatchNormalization的神经网络
Batch Normalization: 使用tf.layers高级函数来构建带有Batch Normalization的神经网络 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 吴 ...
- Tensorflow BatchNormalization详解:2_使用tf.layers高级函数来构建神经网络
Batch Normalization: 使用tf.layers高级函数来构建神经网络 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 吴恩达deeplearningai课程 课程笔 ...
- 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 ...
- tensorflow 一维卷积 tf.layers.conv1()使用
在自然语言处理中,主要使用一维的卷积. API tf.layers.conv1d( inputs, filters, kernel_size, strides=1, padding='valid', ...
- TF中conv2d和kernel_initializer方法
conv2d中的padding 在使用TF搭建CNN的过程中,卷积的操作如下 convolution = tf.nn.conv2d(X, filters, strides=[1,2,2,1], pad ...
- 图融合之加载子图:Tensorflow.contrib.slim与tf.train.Saver之坑
import tensorflow as tf import tensorflow.contrib.slim as slim import rawpy import numpy as np impor ...
- tensorflow 1.0 学习:池化层(pooling)和全连接层(dense)
池化层定义在 tensorflow/python/layers/pooling.py. 有最大值池化和均值池化. 1.tf.layers.max_pooling2d max_pooling2d( in ...
- Tensorflow BatchNormalization详解:4_使用tf.nn.batch_normalization函数实现Batch Normalization操作
使用tf.nn.batch_normalization函数实现Batch Normalization操作 觉得有用的话,欢迎一起讨论相互学习~Follow Me 参考文献 吴恩达deeplearnin ...
随机推荐
- 一、Jmeter环境介绍
1.安装 从Apache网站http://jmeter.apache.org/download_jmeter.cgi下载二进制包. .tgz后缀名的为Linux使用的包 .zip后缀的为windows ...
- Appium -选择、操作元素2
选择元素的方法 根据xpath 在Appium中,我们没法使用css,因为css是web专用的 Appium支持xpath来定位元素 对于一些比较复杂的元素的定位,我们可以用它 driver.find ...
- MongoDB 全部笔记
1. MongoDB: 是NOSQL的一种, 特长是分布式用的,用于处理爬虫数据 2. mongoDB 与 redis mongoDB是最像关系型的非关系型数据,更加适用于大数据,redis则更倾向于 ...
- 20165304《JAVA程序设计》第四周学习总结
教材内容总结 第五章 子类与继承 1.子类声明中通常用关键字extend来定义一个子类(class 子类名 extend 父类名{}) 2.子类和父类在同一包中的继承性,继承的成员变量或方法的访问权限 ...
- 实现一个简单的shell
使用已学习的各种C函数实现一个简单的交互式Shell,要求:1.给出提示符,让用户输入一行命令,识别程序名和参数并调用适当的exec函数执行程序,待执行完成后再次给出提示符.2.该程序可识别和处理以下 ...
- 设计模式入门——Head First
设计模式是被前人发现.经过总结形成了一套某一类问题的一般性解决方案.使用模式最好的方式是:把模式装进脑子,然后在设计和已有的应用中,寻找何处可以使用它们.以往是代码复用,现在是经验复用. 从模拟鸭子游 ...
- Window环境下Python和Django的安装,以及项目的创建
1.首先我们要下载python和Django,他们的下载地址如下 python地址:https://www.python.org/ Django地址: https://www.djangoproje ...
- 8张思维导图学习javascript
分别归类为: javascript变量 javascript运算符 javascript数组 javascript流程语句 javascript字符串函数 javascript函数基础 javascr ...
- IIS Express
当前程序员只能通过下面两种web服务器之一来开发和测试ASP.NET网站程序: 1. Visual Studio自带的ASP.NET开发服务器(webdev.exe). 2. Windows自带的II ...
- [CI]CodeIgniter视图 & 模型 & 控制器
---------------------------------------------------------------------------------------------------- ...