{"id":487,"date":"2013-11-07T23:51:00","date_gmt":"2013-11-08T04:51:00","guid":{"rendered":"http:\/\/zhanxw.com\/blog\/?p=487"},"modified":"2013-11-10T20:33:14","modified_gmt":"2013-11-11T01:33:14","slug":"%e5%ae%89%e8%a3%85theano","status":"publish","type":"post","link":"https:\/\/zhanxw.com\/blog\/2013\/11\/%e5%ae%89%e8%a3%85theano\/","title":{"rendered":"\u5b89\u88c5Theano"},"content":{"rendered":"<p>\u5b89\u88c5Theano<br \/>\nInstall Theano<\/p>\n<p>Theano\u662f\u4e00\u4e2aMachine Learning\u7684\u5de5\u5177\u7bb1\uff0c\u56e0\u4e3a\u548cDeep Learning\u76f8\u5173\uff0c\u73b0\u5728\u975e\u5e38\u6d41\u884c\u3002<\/p>\n<p>\u8fd9\u7bc7\u6587\u7ae0\u7b80\u5355\u8bb0\u5f55\u4e00\u4e0b\u5b89\u88c5Theano\u662f\u9047\u5230\u7684\u95ee\u9898\u3002<\/p>\n<p>1. import theano\u51fa\u9519<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&gt;&gt;&gt; import theano\r\nTraceback (most recent call last):\r\n  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;\r\n  File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/__init__.py&quot;, line 76, in &lt;module&gt;\r\n    import theano.tests\r\n  File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/tests\/__init__.py&quot;, line 6, in &lt;module&gt;\r\n    import unittest_tools\r\n  File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/tests\/unittest_tools.py&quot;, line 8, in &lt;module&gt;\r\n    import theano.tensor as T\r\n  File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/tensor\/__init__.py&quot;, line 10, in &lt;module&gt;\r\n    import blas\r\n  File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/tensor\/blas.py&quot;, line 393, in &lt;module&gt;\r\n    StrParam(default_blas_ldflags()))\r\n  File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/tensor\/blas.py&quot;, line 332, in default_blas_ldflags\r\n    blas_info = numpy.distutils.__config__.blas_opt_info\r\nAttributeError: 'module' object has no attribute '__config__'\r\n<\/pre>\n<p>\u52a0\u5165\u4e0b\u9762\u51e0\u884c\u53ef\u4ee5\u89e3\u51b3\u95ee\u9898\uff1a<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport numpy\r\nimport numpy.distutils\r\nimport numpy.distutils.__config__\r\n<\/pre>\n<p>2.Theano\u65e0\u6cd5\u7f16\u8bd1<\/p>\n<p>\u8fd0\u884c\u793a\u4f8b\u7a0b\u5e8f\u662f\u9047\u5230\u7f16\u8bd1\u9519\u8bef\uff1a<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\nTraceback (most recent call last):\r\n  File &quot;logistic_sgd.py&quot;, line 373, in &lt;module&gt;\r\n    sgd_optimization_mnist()\r\n  File &quot;logistic_sgd.py&quot;, line 271, in sgd_optimization_mnist\r\n    y: test_set_y&#x5B;index * batch_size: (index + 1) * batch_size]})\r\n...\r\n  File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/gof\/cmodule.py&quot;, line 1641, in compile_str\r\n    return dlimport(lib_filename)\r\n  File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/gof\/cmodule.py&quot;, line 263, in dlimport\r\n    rval = __import__(module_name, {}, {}, &#x5B;module_name])\r\nImportError: ('\/net\/fantasia\/home\/zhanxw\/.theano\/compiledir_Linux-3.4.61-x86_64-with-debian-wheezy-sid-x86_64-2.7.5\/tmphSYif1\/baf8a6fdee34b135ea9110785e356489.so: undefined symbol: ATL_dptsyrk', '&#x5B;_dot22(&lt;TensorType(float64, matrix)&gt;, W)]')\r\n<\/pre>\n<p>\u8fd9\u91cc\u7684\u63d0\u793a\u4fe1\u606f\u662f\u627e\u4e0d\u5230ATL_dptsyrk\u51fd\u6570\u3002\u5728\u6ca1\u6709\u7ba1\u7406\u5458\u6743\u9650\u7684\u670d\u52a1\u5668\u4e0a\uff0cTheano\u627e\u4e0d\u5230\u5408\u9002\u7684ATLAS\u51fd\u6570\u5e93\u3002<br \/>\n\u89e3\u51b3\u65b9\u6cd5\u662f\u52a0\u5165\u4ee5\u4e0b\u51e0\u884c\u5230 $HOME\/.theanorc<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;blas]\r\nldflags = -lf77blas -latlas -lgfortran\r\n<\/pre>\n<p>\u5bf9\u4e8e\u5176\u4ed6\u9519\u8bef\u6765\u8bb2\uff0c\u8fd8\u6709\u4e00\u4e9b\u66f4\u4e00\u822c\u7684\u89e3\u51b3\u65b9\u6cd5\u3002<\/p>\n<p>1. \u53ef\u4ee5\u6253\u5f00Theano\u7684\u65e5\u5fd7\u4fe1\u606f\uff0c\u6bd4\u5982\u5728\u7a0b\u5e8f\u4e2d\u52a0\u5165\u8fd9\u4e24\u884c\uff1a<\/p>\n<pre class=\"brush: python; title: ; notranslate\" title=\"\">\r\nimport logging                                                                  |\r\n#logging.getLogger(&quot;theano.gof.cmodule&quot;).setLevel(logging.DEBUG)\r\n<\/pre>\n<p>Theano\u5728\u8fd0\u884c\u662f\u53ef\u4ee5\u8f93\u51fa\u66f4\u591a\u7684\u4fe1\u606f\u3002<\/p>\n<p>2. \u4fdd\u7559\u4e34\u65f6\u6587\u4ef6<br \/>\n\u53ef\u4ee5\u5728 $HOME\/.theanorc \u4e2d\u52a0\u5165\u4ee5\u4e0b\u4e24\u884c<\/p>\n<pre class=\"brush: plain; title: ; notranslate\" title=\"\">\r\n&#x5B;global]\r\nnocleanup = False\r\n<\/pre>\n<p>\u8fd9\u6837\u53ef\u4ee5\u4fdd\u7559Theano\u7f16\u8bd1\u8fc7\u7a0b\u4e2d\u7684\u4e34\u65f6\u6587\u4ef6\uff0c\u4fbf\u4e8e\u8c03\u8bd5\u3002<\/p>\n<p>\u9898\u5916\u8bdd<\/p>\n<p>\u5728\u6709\u7ba1\u7406\u5458\u6743\u9650\u7684Ubuntu\u7cfb\u7edf\uff0c \u53ef\u4ee5\u7528OpenBLAS\u6765\u4ee3\u66ffATLAS\uff0c\u56e0\u4e3aOpenBLAS\u662f\u591a\u7ebf\u7a0b\u7684\uff0c\u800c\u4e14\u901f\u5ea6\u66f4\u5feb\u3002\u5177\u4f53\u53ef\u4ee5\u53c2\u8003Theano \u7684<a href=\"http:\/\/deeplearning.net\/software\/theano\/install_ubuntu.html#install-ubuntu-gpu\" title=\"Install Theano under Ubuntu\">\u624b\u518c<\/a>\u3002<\/p>\n<p>\u73b0\u5728Theano\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\uff0c\u5e0c\u671b\u63a5\u4e0b\u6765\u51e0\u7bc7blog\u6709\u7a7a\u80fd\u5199\u5199\u5b66\u4e60Deep Learning\u7684\u5fc3\u5f97\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b89\u88c5Theano Install Theano Theano\u662f\u4e00\u4e2aMachine Learning\u7684\u5de5\u5177\u7bb1\uff0c\u56e0\u4e3a\u548cDeep Learning\u76f8\u5173\uff0c\u73b0\u5728\u975e\u5e38\u6d41\u884c\u3002 \u8fd9\u7bc7\u6587\u7ae0\u7b80\u5355\u8bb0\u5f55\u4e00\u4e0b\u5b89\u88c5Theano\u662f\u9047\u5230\u7684\u95ee\u9898\u3002 1. import theano\u51fa\u9519 &gt;&gt;&gt; import theano Traceback (most recent call last): File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt; File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/__init__.py&quot;, line 76, in &lt;module&gt; import theano.tests File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/tests\/__init__.py&quot;, line 6, in &lt;module&gt; import unittest_tools File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/tests\/unittest_tools.py&quot;, line 8, in &lt;module&gt; import theano.tensor as T File &quot;\/net\/fantasia\/home\/zhanxw\/python\/lib\/python2.7\/site-packages\/Theano-0.6.0rc3-py2.7.egg\/theano\/tensor\/__init__.py&quot;, line 10, in [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[126,53,125],"class_list":["post-487","post","type-post","status-publish","format-standard","hentry","category-sysadmin","tag-deep-learning","tag-python","tag-theano"],"_links":{"self":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts\/487","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/comments?post=487"}],"version-history":[{"count":0,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/posts\/487\/revisions"}],"wp:attachment":[{"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/media?parent=487"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/categories?post=487"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zhanxw.com\/blog\/wp-json\/wp\/v2\/tags?post=487"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}