欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

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

 更新時間:2018年02月11日 09:19:30   作者:松松的鞋帶兒  
本篇文章主要介紹了TensorFlow中權重的隨機初始化的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧

一開始沒看懂stddev是什么參數(shù),找了一下,在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.
 """

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

截斷正態(tài)分布,以前都沒聽說過。

TensorFlow還提供了平均分布等。

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

相關文章

  • pymongo為mongodb數(shù)據(jù)庫添加索引的方法

    pymongo為mongodb數(shù)據(jù)庫添加索引的方法

    這篇文章主要介紹了pymongo為mongodb數(shù)據(jù)庫添加索引的方法,涉及Python操作mongodb數(shù)據(jù)庫的相關技巧,非常簡單實用,需要的朋友可以參考下
    2015-05-05
  • 關于pytorch多GPU訓練實例與性能對比分析

    關于pytorch多GPU訓練實例與性能對比分析

    今天小編就為大家分享一篇關于pytorch多GPU訓練實例與性能對比分析,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-08-08
  • python3.6使用tkinter實現(xiàn)彈跳小球游戲

    python3.6使用tkinter實現(xiàn)彈跳小球游戲

    這篇文章主要為大家詳細介紹了python3.6使用tkinter實現(xiàn)彈跳小球游戲,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-05-05
  • 詳解Python實現(xiàn)按任意鍵繼續(xù)/退出的功能

    詳解Python實現(xiàn)按任意鍵繼續(xù)/退出的功能

    在學Python時在總想實現(xiàn)一個按任意鍵繼續(xù)/退出的程序(受.bat毒害), 奈何一直沒有寫,今天抽時間寫出來了,下面分享給大家,有需要的可以參考借鑒。
    2016-08-08
  • Python?OpenCV?Canny邊緣檢測算法的原理實現(xiàn)詳解

    Python?OpenCV?Canny邊緣檢測算法的原理實現(xiàn)詳解

    這篇文章主要介紹了Python?OpenCV?Canny邊緣檢測算法的原理實現(xiàn)詳解,由于邊緣檢測對噪聲敏感,因此對圖像應用高斯平滑以幫助減少噪聲,具體詳情需要的小伙伴可以參考一下
    2022-07-07
  • 淺談Tensorflow加載Vgg預訓練模型的幾個注意事項

    淺談Tensorflow加載Vgg預訓練模型的幾個注意事項

    這篇文章主要介紹了淺談Tensorflow加載Vgg預訓練模型的幾個注意事項說明,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2020-05-05
  • Python之Pygame的Draw繪圖

    Python之Pygame的Draw繪圖

    Pygame 中提供了一個draw模塊用來繪制一些簡單的圖形狀,比如矩形、多邊形、圓形、直線、弧線等。本文主要介紹Pygame中的Draw繪圖,感興趣的同學可以參考閱讀
    2023-04-04
  • python使用cPickle模塊序列化實例

    python使用cPickle模塊序列化實例

    這篇文章主要介紹了python使用cPickle模塊序列化的方法,是一個非常實用的技巧,需要的朋友可以參考下
    2014-09-09
  • Python中字符串List按照長度排序

    Python中字符串List按照長度排序

    這篇文章主要介紹了字符串List按照長度排序(python)的實現(xiàn)方法啊,本文通過實例代碼給大家介紹的非常詳細,具有一定的參考借鑒價值,需要的朋友可以參考下
    2019-07-07
  • 使用pandas的box_plot去除異常值

    使用pandas的box_plot去除異常值

    今天小編就為大家分享一篇使用pandas的box_plot去除異常值,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2019-12-12

最新評論