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

首頁(yè) > 編程 > Python > 正文

TensorFlow中權(quán)重的隨機(jī)初始化的方法

2020-02-22 23:13:09
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

一開(kāi)始沒(méi)看懂stddev是什么參數(shù),找了一下,在tensorflow/python/ops里有random_ops,其中是這么寫(xiě)的:

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. """

也就是按照正態(tài)分布初始化權(quán)重,mean是正態(tài)分布的平均值,stddev是正態(tài)分布的標(biāo)準(zhǔn)差(standard deviation),seed是作為分布的random seed(隨機(jī)種子,我百度了一下,跟什么偽隨機(jī)數(shù)發(fā)生器還有關(guān),就是產(chǎn)生隨機(jī)數(shù)的),在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. """

截?cái)嗾龖B(tài)分布,以前都沒(méi)聽(tīng)說(shuō)過(guò)。

TensorFlow還提供了平均分布等。

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持武林站長(zhǎng)站。

發(fā)表評(píng)論 共有條評(píng)論
用戶(hù)名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 临桂县| 张家口市| 文安县| 彝良县| 抚松县| 阿荣旗| 寿阳县| 兰溪市| 高尔夫| 临朐县| 盘锦市| 雅江县| 航空| 多伦县| 新民市| 偏关县| 县级市| 双城市| 贺兰县| 久治县| 大同市| 扬州市| 常山县| 延庆县| 客服| 卫辉市| 磴口县| 腾冲县| 广宗县| 郧西县| 桂林市| 彭山县| 南江县| 常宁市| 黄平县| 巴彦县| 双峰县| 互助| 竹山县| 惠东县| 宁蒗|