<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                # Python 深度學習庫 Theano 簡介 > 原文: [https://machinelearningmastery.com/introduction-python-deep-learning-library-theano/](https://machinelearningmastery.com/introduction-python-deep-learning-library-theano/) Theano 是一個用于快速數值計算的 Python 庫,可以在 CPU 或 GPU 上運行。 它是 Python 中深度學習的關鍵基礎庫,您可以直接使用它來創建深度學習模型或包裝庫,從而大大簡化過程。 在這篇文章中,您將發現 Theano Python 庫。 ![Introduction to the Python Deep Learning Library Theano](https://img.kancloud.cn/ca/63/ca63daccca8c704e0ae33ca510a06d89_640x427.png) Python 深度學習庫 Theano 照片由 [Kristoffer Trolle](https://www.flickr.com/photos/kristoffer-trolle/17088729869/) 拍攝,保留一些權利。 ## 什么是 Theano? Theano 是一個根據 BSD 許可發布的開源項目,由加拿大魁北克省蒙特利爾大學(現為 [Yoshua Bengio](http://www.iro.umontreal.ca/~bengioy/yoshua_en/index.html) 的所在地)的 LISA(現為 [MILA](http://mila.umontreal.ca/) )小組開發。它以[希臘數學家](https://en.wikipedia.org/wiki/Theano_(philosopher))的名字命名。 在它的核心 Theano 是 Python 中數學表達式的編譯器。它知道如何使用您的結構并將它們轉換為非常有效的代碼,使用 NumPy,高效的本機庫(如 [BLAS](http://www.netlib.org/blas/) 和本機代碼(C ++))在 CPU 或 GPU 上盡可能快地運行。 它使用大量巧妙的代碼優化來盡可能地從硬件中獲取盡可能多的表現。如果你深入研究代碼中數學優化的細節,[請查看這個有趣的列表](http://deeplearning.net/software/theano/optimizations.html#optimizations)。 Theano 表達式的實際語法是象征性的,這可能不適合初學者用于正常的軟件開發。具體而言,表達式在抽象意義上定義,編譯后實際用于進行計算。 它專門用于處理深度學習中使用的大型神經網絡算法所需的計算類型。它是同類中最早的庫之一(2007 年開始開發),被認為是深度學習研究和開發的行業標準。 ## 如何安裝 Theano Theano 為主要操作系統提供了廣泛的安裝說明:Windows,OS X 和 Linux。閱讀適合您平臺的[安裝 Theano 指南](http://deeplearning.net/software/theano/install.html)。 Theano 假設使用 [SciPy](https://www.scipy.org/) 工作的 Python 2 或 Python 3 環境。有一些方法可以使安裝更容易,例如使用 [Anaconda](https://www.continuum.io/downloads) 在您的機器上快速設置 Python 和 SciPy 以及使用 [Docker 圖像](http://deeplearning.net/software/theano/install.html#docker-images)。 使用 Python 和 SciPy 環境,安裝 Theano 相對簡單。來自 PyPI 使用 pip,例如: ```py pip install Theano ``` 在撰寫本文時,Theano 的最后一個正式版本是在 2016 年 3 月 21 日發布的 0.8 版本。 可能會發布新版本,您需要更新以獲取任何錯誤修復和效率改進。您可以使用 pip 升級 Theano,如下所示: ```py sudo pip install --upgrade --no-deps theano ``` 您可能想要使用直接從 Github 檢查的最新版本的 Theano。 對于一些使用前沿 API 更改的包裝器庫,可能需要這樣做。您可以直接從 Github 結帳安裝 Theano,如下所示: ```py pip install --upgrade --no-deps git+git://github.com/Theano/Theano.git ``` 您現在已準備好在 CPU 上運行 Theano,這對于小型模型的開發來說非常好。 大型號可能在 CPU 上運行緩慢。如果你有一個 Nvidia GPU,你可能想要配置 Theano 來使用你的 GPU。閱讀[使用適用于 Linux](http://deeplearning.net/software/theano/install.html#using-the-gpu) 或 [Mac OS X 的 GPU 指南設置 Theano 使用 GPU](http://deeplearning.net/software/theano/install.html#gpu-macos) 和[使用 GPU 指南](http://deeplearning.net/software/theano/tutorial/using_gpu.html)如何測試是否可以工作中。 ## 簡單的 Theano 例子 在本節中,我們將演示一個簡單的 Python 腳本,它為您提供了 Theano 的味道。 它取自 [Theano 概覽指南](http://deeplearning.net/software/theano/introduction.html)。在這個例子中,我們定義了兩個符號浮點變量 _a_ 和 _b_ 。 我們定義了一個使用這些變量 _(c = a + b)_ 的表達式。 然后我們使用 Theano 將這個符號表達式編譯成一個函數,我們稍后可以使用它。 最后,我們使用我們的編譯表達式,插入一些實際值并使用高效的編譯 Theano 代碼執行計算。 ```py import theano from theano import tensor # declare two symbolic floating-point scalars a = tensor.dscalar() b = tensor.dscalar() # create a simple expression c = a + b # convert the expression into a callable object that takes (a,b) # values as input and computes a value for c f = theano.function([a,b], c) # bind 1.5 to 'a', 2.5 to 'b', and evaluate 'c' assert 4.0 == f(1.5, 2.5) ``` 運行該示例不提供任何輸出。 _1.5 + 2.5 = 4.0_ 的斷言是正確的。 這是一個有用的示例,因為它為您提供了如何定義,編譯和使用符號表達式的風格。您可以看到這可以擴展到深度學習所需的大向量和矩陣運算。 ## Theano 的擴展和包裝 如果您不熟悉深度學習,則不必直接使用 Theano。 實際上,我們強烈建議您使用許多流行的 Python 項目之一,這些項目使 Theano 更容易用于深度學習。 這些項目提供 Python 中的數據結構和行為,專門用于快速可靠地創建深度學習模型,同時確保由 Theano 創建和執行快速高效的模型。 庫提供的 Theano 語法的數量各不相同。 * 例如, [Lasagne 庫](http://lasagne.readthedocs.org/en/latest/)為創建深度學習模型提供了便利類,但仍希望您了解并使用 Theano 語法。這對于知道或愿意學習一點 Theano 的初學者來說也是有益的。 * 另一個例子是 [Keras](http://keras.io/) 完全隱藏 Theano 并提供了一個非常簡單的 API 來創建深度學習模型。它很好地隱藏了 Theano,它實際上可以作為另一個流行的基礎框架 [TensorFlow](https://www.tensorflow.org/) 的包裝器運行。 我強烈建議您直接嘗試使用 Theano,然后選擇一個包裝庫來學習和練習深度學習。 有關在 Theano 上構建的庫的完整列表,請參閱 Theano Wiki 上的[相關項目指南](https://github.com/Theano/Theano/wiki/Related-projects)。 ## 更多 Theano 資源 在 Theano 尋找更多資源?看看下面的一些內容。 * [Theano 官方主頁](http://deeplearning.net/software/theano/) * [Theano GitHub 存儲庫](https://github.com/Theano/Theano/) * [Theano:Python 中的 CPU 和 GPU 數學編譯器](http://www.iro.umontreal.ca/~lisa/pointeurs/theano_scipy2010.pdf)(2010)(PDF) * [在 Theano 上建立的庫名單](https://github.com/Theano/Theano/wiki/Related-projects) * [Theano 配置選項列表](http://deeplearning.net/software/theano/library/config.html) ### Theano 和深度學習教程 * [Theano 教程](http://deeplearning.net/software/theano/tutorial/index.html) * [Theano 教程的深度學習](http://www.deeplearning.net/tutorial/) ### 獲得 Theano 的幫助 * [Theano 用戶 Google Group](http://groups.google.com/group/theano-users?pli=1) ## 摘要 在這篇文章中,您發現了 Theano Python 庫,用于高效的數值計算。 您了解到它是一個用于深度學習研究和開發的基礎庫,它可以直接用于創建深度學習模型,或者通過基于它的便利庫(如 Lasagne 和 Keras)。 您對 Theano 或 Python 中的深度學習有任何疑問嗎?在評論中提出您的問題,我會盡力回答。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看