国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 日照市| 龙山县| 侯马市| 西充县| 江门市| 江门市| 清新县| 宜兰市| 南皮县| 甘洛县| 贡觉县| 工布江达县| 新闻| 上林县| 柞水县| 东港市| 新昌县| 桂林市| 渝中区| 祁连县| 常宁市| 余庆县| 康平县| 四子王旗| 湘西| 神池县| 梧州市| 股票| 峡江县| 合水县| 绿春县| 雅安市| 阜新市| 平塘县| 文成县| 塔城市| 博爱县| 思南县| 石林| 永安市| 乾安县|