国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

TensorFlow中權重的隨機初始化的方法

2020-01-04 15:52:27
字體:
來源:轉載
供稿:網友

一開始沒看懂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還提供了平均分布等。

以上就是本文的全部內容,希望對大家的學習有所幫助,也希望大家多多支持VEVB武林網。


注:相關教程知識閱讀請移步到python教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 铁力市| 贵州省| 江城| 康定县| 泽州县| 监利县| 怀集县| 江油市| 彭泽县| 凤城市| 湘潭县| 鸡泽县| 三江| 民乐县| 巍山| 黄冈市| 垣曲县| 兴隆县| 皮山县| 额敏县| 香港| 许昌县| 开封市| 东丰县| 方山县| 同江市| 揭东县| 三江| 宕昌县| 凌海市| 吉木萨尔县| 泾源县| 莎车县| 吴江市| 阿拉善左旗| 阳春市| SHOW| 冀州市| 图们市| 尚义县| 高邮市|