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, ifTruealso 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 ...
随机推荐
- python linux 下开发环境搭建
1.1: 在虚拟环境目录下安装 ipython => pip install ipython 1.2: 简单的使用 => ipthyon => print("heollo ...
- 那些年用过的Redis集群架构
今天我们来谈谈Redis集群这个话题,需要说明的是本文 适合人群:不知道自己生产redis集群架构,以及对Redis集群不了解的人 不适合群: 对自己生产Redis集群架构非常了解的人 本文预计分两个 ...
- Office2019都有哪些强大功能
前阵子是微软一年一度的Ignite大会.而其中最引人注目.也是与我们一般人最息息相关的消息,当然是Office 2019的正式发布. 尽管Office 2019所更新的功能,对于Office 365的 ...
- Django基础介绍
1.web应用 Web应用程序是一种可以通过Web访问的应用程序,程序的最大好处是用户很容易访问应用程序,用户只需要有浏览器即可,不需要再安装其他软件. 应用程序有两种模式C/S.B/S.C/S是客户 ...
- 关于maven中的快照版本(snapshot)与正式版本(release)解析。
Maven中建立的依赖管理方式基本已成为Java语言依赖管理的事实标准,Maven的替代者Gradle也基本沿用了Maven的依赖管理机制.在Maven依赖管理中,唯一标识一个依赖项是由该依赖项的三个 ...
- oracle第二天笔记
多表查询 /* 多表查询: 笛卡尔积: 实际上是两张表的乘积,但是在实际开发中没有太大意义 格式: select * from 表1,表2 */ select * from emp; select * ...
- NETIF_F_LLTX 的属性
在bond初始化的时候,我们可以看到如下属性: /* don't acquire bond device's netif_tx_lock when transmitting */ bond_d ...
- 【364】SVM 通过 sklearn 可视化实现
先看下效果图: # 先调入需要的模块 import numpy as np import matplotlib.pyplot as plt from sklearn import svm import ...
- mybatis中事务简单使用
一步: 事务只用在service层方法上加 @Transactional(propagation = Propagation.REQUIRED) :发现如果没有它,增加执行-->1/ ...
- C++ CTreeview的checkbox使用方法
1. 消息事件 (1)鼠标点击当前ITEM的CHECKBOX:引发NM_CLICK事件并传递TVHT_ONITEMSTATEICON. (2)鼠标点击当前ITEM的TEXT:引发NM_CLIC ...