一开始没看懂stddev是什么参数,找了一下,在tensorflow/python/ops里有random_ops,其中是这么写的:

def random_normal(shape, mean=0.0, stddev=1.0, dtype=types.float32,
seed=None, name=None):
"""Outputs random values from a normal distribution. Args:
shape: A 1-D integer Tensor or Python array. The shape of the output tensor.
mean: A 0-D Tensor or Python value of type `dtype`. The mean of the normal
distribution.
stddev: A 0-D Tensor or Python value of type `dtype`. The standard deviation
of the normal distribution.
dtype: The type of the output.
seed: A Python integer. Used to create a random seed for the distribution.
See
[`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed)
for behavior.
name: A name for the operation (optional). Returns:
A tensor of the specified shape filled with random normal values.
"""

  也就是按照正态分布初始化权重,mean是正态分布的平均值,stddev是正态分布的标准差(standard deviation),seed是作为分布的random seed(随机种子,我百度了一下,跟什么伪随机数发生器还有关,就是产生随机数的),在mnist/concolutional中seed赋值为66478,挺有意思,不知道是什么原理。

  后面还有truncated_normal的定义:

def truncated_normal(shape, mean=0.0, stddev=1.0, dtype=types.float32,
seed=None, name=None):
"""Outputs random values from a truncated normal distribution. The generated values follow a normal distribution with specified mean and
standard deviation, except that values whose magnitude is more than 2 standard
deviations from the mean are dropped and re-picked. Args:
shape: A 1-D integer Tensor or Python array. The shape of the output tensor.
mean: A 0-D Tensor or Python value of type `dtype`. The mean of the
truncated normal distribution.
stddev: A 0-D Tensor or Python value of type `dtype`. The standard deviation
of the truncated normal distribution.
dtype: The type of the output.
seed: A Python integer. Used to create a random seed for the distribution.
See
[`set_random_seed`](../../api_docs/python/constant_op.md#set_random_seed)
for behavior.
name: A name for the operation (optional). Returns:
A tensor of the specified shape filled with random truncated normal values.
"""

  截断正态分布,以前都没听说过。

  TensorFlow还提供了平均分布等。

参考:

1.https://tensorflow.googlesource.com/tensorflow/+/refs/heads/master/tensorflow/g3doc/api_docs/python

2.随机种子:http://baike.baidu.com/link?url=bjDp9u9pkEg2oWOffMep1RW6B1U-0AX2FNmykTtCAa8L_7xzA0ygq6AyLBf8pv7XW8b4gwUKlvMWiCsp32Nu8K

TensorFlow中权重的随机初始化的更多相关文章

  1. tensorflow中的参数初始化方法

    1. 初始化为常量 tf中使用tf.constant_initializer(value)类生成一个初始值为常量value的tensor对象. constant_initializer类的构造函数定义 ...

  2. 第二十二节,TensorFlow中的图片分类模型库slim的使用、数据集处理

    Google在TensorFlow1.0,之后推出了一个叫slim的库,TF-slim是TensorFlow的一个新的轻量级的高级API接口.这个模块是在16年新推出的,其主要目的是来做所谓的“代码瘦 ...

  3. 第二十二节,TensorFlow中RNN实现一些其它知识补充

    一 初始化RNN 上一节中介绍了 通过cell类构建RNN的函数,其中有一个参数initial_state,即cell初始状态参数,TensorFlow中封装了对其初始化的方法. 1.初始化为0 对于 ...

  4. Tensorflow 中的优化器解析

    Tensorflow:1.6.0 优化器(reference:https://blog.csdn.net/weixin_40170902/article/details/80092628) I:  t ...

  5. 第十八节,TensorFlow中使用批量归一化(BN)

    在深度学习章节里,已经介绍了批量归一化的概念,详情请点击这里:第九节,改善深层神经网络:超参数调试.正则化以优化(下) 神经网络在进行训练时,主要是用来学习数据的分布规律,如果数据的训练部分和测试部分 ...

  6. TensorFlow中数据读取之tfrecords

    关于Tensorflow读取数据,官网给出了三种方法: 供给数据(Feeding): 在TensorFlow程序运行的每一步, 让Python代码来供给数据. 从文件读取数据: 在TensorFlow ...

  7. ML(5)——神经网络3(随机初始化与梯度检验)

    随机初始化 在线性回归和逻辑回归中,使用梯度下降法之前,将θ设置为0向量,有时会习惯性的将神经网络中的权重全部初始化为0,然而这在神经网络中并不适用. 以简单的三层神经网络为例,将全部权重都设置为0, ...

  8. tensorflow中slim模块api介绍

    tensorflow中slim模块api介绍 翻译 2017年08月29日 20:13:35   http://blog.csdn.net/guvcolie/article/details/77686 ...

  9. Tensorflow中使用CNN实现Mnist手写体识别

    本文参考Yann LeCun的LeNet5经典架构,稍加ps得到下面适用于本手写识别的cnn结构,构造一个两层卷积神经网络,神经网络的结构如下图所示: 输入-卷积-pooling-卷积-pooling ...

随机推荐

  1. Intent中的四个重要属性——Action、Data、Category、Extras

    Intent作为联系各Activity之间的纽带,其作用并不仅仅只限于简单的数据传递.通过其自带的属性,其实可以方便的完成很多较为复杂的操作.例如直接调用拨号功能.直接自动调用合适的程序打开不同类型的 ...

  2. Sqoop使用手册

    转载请注明出处:http://www.cnblogs.com/xiaodf/ 1 Sqoop概述 2 版本说明 3 驱动安装 3.1 MySQL 4 基本用法 4.1 导入 4.1.1 保护密码 4. ...

  3. Javascript 右移0位的作用

    Javascript 中右移0位可以用来快速去掉小数,关于位移运算的定义: 右移运算是将一个二进制位的操作数按指定移动的位数向右移动,移出位被丢弃,左边移出的空位或者一律补0,或者补符号位. 实际看下 ...

  4. iphone 浏览器自动解析数字为号码解决方法

    iphone 浏览器自动解析数字为号码解决方法 www.MyException.Cn  网友分享于:2015-10-09  浏览:0次   iphone 浏览器自动解析数字为号码解决办法 在工作中遇到 ...

  5. Android驱动开发前的准备(四)

    源代码的下载和编译 4.1 下载.编译和测试Android源代码 4.2下载和编译linux内核源代码 4.1.1 配置Android源代码下载环境 (1) 创建一个用于存放下载脚本文件的目录 # m ...

  6. 转战网站后台与python

    这么长时间了,迷茫的大雾也逐渐散去,正如标题所写的一样,转战网站后台开发.这段时间没怎么写博客,主要还是太忙,忙着期末考试的预习,以及服务器的搭建,python的学习,还有各种各样杂七杂八的小事,就像 ...

  7. Linux运维人员如何学习python编程

    Linux运维人员如何学习python编程 从不会写代码,到自己独立能写代码解决问题 .这个问题很重要!盲目学习所谓的项目,最后 还是不会自己写代码解决问题.首先解决了独立能写代码解决问题,再通过项目 ...

  8. CE 操作串口

    WinCE里面都是通过标准的系统API对串口进行操作的,但是串口不同于其它文件,它是是独占式地操作的. 下面是一个操作的串口类: #pragma once typedef void (*LPDataA ...

  9. Maximum Depth of Binary Tree

    二叉树最大深度的递归实现. /** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNo ...

  10. 开发adobe ane分享

    最近的项目使用adobe air开发,不可能避免的要使用到ane,项目初期的时候,使用了网上搜索到的了一些开源ane,最后发现,很多都不完善,要么版本太久,要么BUG很多,无人维护,所以下决心自己开发 ...