国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 德江县| 商城县| 勃利县| 故城县| 罗源县| 元朗区| 丰城市| 包头市| 福州市| 苍山县| 特克斯县| 福州市| 泉州市| 汶上县| 奈曼旗| 沧州市| 吴川市| 固安县| 漯河市| 石嘴山市| 宜都市| 岑巩县| 和政县| 新昌县| 清丰县| 西青区| 武陟县| 河池市| 贵定县| 渝北区| 长沙市| 谷城县| 翁牛特旗| 黎川县| 盐城市| 锡林郭勒盟| 隆化县| 铜鼓县| 崇义县| 柞水县| 大化|