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 ...
随机推荐
- spring Boot 上传文件,10天后,不能上传的bug
起因 公司研发人员 部署服务在阿里云 ecs 服务器; 上传文件过1周左右文件自动丢失; 排查思路: (1).查询tomcat 启动日志出现如下信息: java.io.IOException: The ...
- 解决Mac上安装mysqlclient的错误
要想使用python操作mysql,那么就需要安装python操作数据库的驱动,由于mysqldb不支持python3,我选择安装mysqlclient, 命令行输入:pip3 install ...
- Delphi XE3通过ADOConnection 连接 MySQL 5.5.27 数据库
Delphi XE3通过ADOConnection 连接 MySQL 5.5.27 数据库 unit Unit1; interface uses Winapi.Windows, Winapi.Mess ...
- python 小整数池 和intern 【整理】
小整数对象池 (在python内置了) 整数在程序中的使用非常广泛,Python为了优化速度,使用了小整数对象池,避免为整数频繁申请和销毁内存空间. Python对小整数的定义是[-5,257]这些整 ...
- Jetty-attack-test
import httplib, urllib, ssl, string, sys, getopt from urlparse import urlparse ''' Author: Gotham Di ...
- JS简单示例
首先感谢海棠学院提供的优质视频资源 学习总是一个由简单到难的过程,由浅入深,一步一个脚印,将学过的点玩的深入一点,才能有所进步,单学习总是枯燥而乏味的,切忌焦躁; 示例代码另存放在github:htt ...
- hive sql 效率提升
转 : http://www.cnblogs.com/xd502djj/p/3799432.html hive的查询注意事项以及优化总结 . Hive是将符合SQL语法的字符串解析生成可以在Hado ...
- js高级-函数的四种调用模式
1.对象方法调用模式 方法内部的this指向当前调用者的对象d 定义类 (构造函数) function Dog (dogName){ //创建一个空对象 让空对象==this this.name ...
- 移动端引用echarts的折线图
移动端写一个图表引用echarts,highcharts插件,本次要找一个能够显示最新数据的折线图,最后只找到显示最大值: 找到echarts的实例:记一下个各功能. <!DOC ...
- 部署Java的运行环境
1.先去官网下载最新的jdk 网址:http://www.oracle.com/technetwork/java/javase/downloads/ 2.用tar zxvf解压相应的文档到相应的路径 ...