{"id":709,"date":"2017-03-01T18:13:52","date_gmt":"2017-03-01T10:13:52","guid":{"rendered":"http:\/\/www.withonly.com\/?p=709"},"modified":"2017-03-01T18:13:52","modified_gmt":"2017-03-01T10:13:52","slug":"mxnet-%e6%b7%b1%e5%ba%a6%e5%ad%a6%e4%b9%a0%e6%a1%86%e6%9e%b6%e5%ae%89%e8%a3%85%ef%bc%88%e4%b8%80%ef%bc%89","status":"publish","type":"post","link":"https:\/\/blog.5danyuan.com\/?p=709","title":{"rendered":"MxNet \u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u5b89\u88c5\uff08\u4e00\uff09"},"content":{"rendered":"<p>\u6700\u8fd1\u662f\u60f3\u770b\u770b\u6df1\u5ea6\u5b66\u4e60\u7684\u4e1c\u897f\uff0c\u7f51\u4e0a\u6709\u641c\u7d22\u4e00\u4e0b\uff0c\u8c8c\u4f3cMxNet\u8fd8\u4e0d\u9519\uff0c\u4e8e\u662f\u6253\u7b97\u9009\u62e9\u8be5\u5e93\u4f5c\u4e3a\u5165\u624b\u3002<\/p>\n<p>\u4f5c\u4e3a\u7cfb\u5217\u6587\u7ae0\u7684\u7b2c\u4e00\u7bc7\uff0c\u5f53\u7136\u662f\u5b89\u88c5\u62c9\uff0c\u8fd9\u91cc\u4ee5windows 10\u5b89\u88c5\u4e3a\u4f8b\uff0cUbuntu\u4e0a\u7684\u5c31\u518d\u7b49\u7b49\u5427\u3002<\/p>\n<p>\u5728\u5b89\u88c5\u4e4b\u524d\uff0c\u5927\u5bb6\u9700\u8981\u6df1\u5ea6\u5b66\u4e60\u7684\u4f7f\u7528\u8bed\u8a00\uff0c\u591a\u4e3apython\u548cc+\u4e4b\u7c7b\u7684\u3002MxNet\u652f\u6301\u7684\u8bed\u8a00\u6bd4\u8f83\u591a\uff0c\u5bf9R\u4e5f\u652f\u6301\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5Python\uff0c\u4ece\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u5b89\u88c5\u5305\uff0c\u8863\u670d\u81ea\u5df1\u6d17\u8fd9\u91cc\u9009\u62e9\u7684\u662f3.6\u7684\u7248\u672c\uff0c\u4e00\u8def\u65e0\u8111\u4e0b\u4e00\u6b65\u5373\u53ef\u3002\u5728\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8bf7\u786e\u4fddpython\u7684\u8def\u5f84\u5df2\u7ecf\u88ab\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e0b\u3002<\/p>\n<p>\u63a5\u4e0b\u6765\uff0c\u518d\u5b89\u88c5 pip\uff0c\u4ece\u5b98\u7f51\u4e0a\u4e0b\u8f7d\u6587\u4ef6\u5230\u672c\u5730\uff0c\u7136\u540e\u8fd0\u884c<\/p>\n<p>python\u00a0get-pip.py install<\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u8bf7\u6dfb\u52a0python\u76ee\u5f55\u4e0b\u7684scripts\u76ee\u5f55\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e0b\u3002\u63a5\u4e0b\u6765\u5b89\u88c5 numpy\uff0c\u8fdb\u5165\u00a0https:\/\/pypi.python.org\/pypi\/numpy\uff0c\u9009\u62e9\u5bf9\u5e94\u7684whl\u7248\u672c\uff0c\u4e0b\u8f7d\u5230\u672c\u5730\uff0c\u7136\u540e\u8fd0\u884c<\/p>\n<p>pip install numpy.whl<\/p>\n<p>\u5728\u5f00\u59cb\u7684\u65f6\u5019\uff0c\u8863\u670d\u81ea\u5df1\u6d17\u9009\u62e9\u7684\u4ece\u7f51\u4e0a\u5b89\u88c5\uff0c\u603b\u662f\u4f1a\u5931\u8d25\uff0c\u641c\u7d22\u4e86\u4e00\u756a\u624d\u679c\u65ad\u91c7\u7528\u79bb\u7ebf\u5b89\u88c5\uff0c\u5f88\u662f\u987a\u5229\u3002<\/p>\n<p>\u4e0b\u9762\u5c31\u662f\u6b63\u4e3b\u4e0a\u573a\u62c9\uff0c\u4ecehttps:\/\/github.com\/dmlc\/mxnet\/releases\u4e0b\u8f7d\u9884\u7f16\u8bd1\u597d\u7684\u5305\uff0c\u7531\u4e8e\u6211\u7684\u673a\u5668\u4e0d\u652f\u6301cuda\uff0c\u6240\u4ee5\u5c31\u4e0b\u8f7d\u7684\u662fcpu\u7684\u7248\u672c\uff0c\u4f8b\u598220160531_win10_x64_cpu.7z\uff0c\u89e3\u538b\u7f29\u5230\u672c\u5730\uff0c\u8fd9\u6837\u7684\u4e1c\u897f\u6211\u8fd8\u662f\u653e\u5230C\u76d8\u6839\u76ee\u5f55\u4e0b\u6bd4\u8f83\u4fdd\u9669\u70b9\u3002<\/p>\n<p>\u5bf9\u4e8e\u60f3\u73a9CUDA\u7684\u540c\u5b66\uff0c\u8bf7\u5148\u5230nvadia\u53bb\u6ce8\u518c\uff0c\u7136\u540e\u4e0b\u8f7d\u4ed6\u4eec\u7684SDK\uff0c\u89e3\u538b\u7f29\u540e\u653e\u5230mxnet\\3rdparty\\cuda \u76ee\u5f55\u4e0b\u3002<\/p>\n<p>\u6700\u540e\u4e00\u6b65\u5c31\u662f\u51c6\u5907\u914d\u7f6e\u4e86\uff0c\u6309\u7167\u5b98\u65b9\u7684readme\u6587\u4ef6\uff0c\u8fdb\u5165\u5230mxnet\u7684\u76ee\u5f55\uff0c\u53cc\u51fb\u8fd0\u884csetupenv.cmd\u6765\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u518d\u8fdb\u5165\u5230 mxnet\\python\u76ee\u5f55\uff0c\u8fd0\u884c python setup.py install.<\/p>\n<p>\u5982\u679c\u4e00\u5207\u90fd\u987a\u5229\u7684\u8bdd\uff0c\u5e94\u8be5\u662f\u53ef\u4ee5\u5b89\u88c5\u6210\u529f\u7684\u3002<\/p>\n<p>\u5982\u4f55\u9a8c\u8bc1\u5462\uff0c\u8fd0\u884c\u4e0b\u9762\u7684\u547d\u4ee4<\/p>\n<blockquote><p>C:\\&gt; python<br \/>\n&gt;&gt;&gt; import mxnet as mx<br \/>\n&gt;&gt;&gt; a=mx.nd.zeros((2,3))<br \/>\n&gt;&gt;&gt; print(a.asnumpy())<\/p><\/blockquote>\n<p>\u5982\u679c\u7ed3\u679c\u4e3a<\/p>\n<blockquote><p>[[0. 0. 0.]<br \/>\n[0. 0. 0.]]<\/p><\/blockquote>\n<p>\u5c31\u8868\u660emx\u5b89\u88c5\u6210\u529f\u62c9\u3002<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u4f7f\u7528C++\u6765\u5f00\u53d1\u7684\u8bdd\uff0c\u8bf7\u4f7f\u7528mxnet\\lib\u76ee\u5f55\u4e0b\u7684\u6587\u4ef6\uff1alibmxnet.dll\u548clibmxnet.lib\u3002<\/p>\n<p>\u4eca\u5929\u7684\u5185\u5bb9\u5c31\u5230\u6b64\u7ed3\u675f\uff0c\u770b\u8d77\u6765\u5f88\u7b80\u5355\uff0c\u786e\u5b9e\u82b1\u4e86\u4e00\u4e2a\u4e0b\u5348\u7684\u65f6\u95f4\u624d\u7406\u6e05\u3002\u6709\u4ec0\u4e48\u4e0d\u61c2\u7684\uff0c\u6b22\u8fce\u7559\u8a00\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u662f\u60f3\u770b\u770b\u6df1\u5ea6\u5b66\u4e60\u7684\u4e1c\u897f\uff0c\u7f51\u4e0a\u6709\u641c\u7d22\u4e00\u4e0b\uff0c\u8c8c\u4f3cMxNet\u8fd8\u4e0d\u9519\uff0c\u4e8e\u662f\u6253\u7b97\u9009\u62e9\u8be5\u5e93\u4f5c\u4e3a\u5165\u624b\u3002 \u4f5c\u4e3a\u7cfb\u5217\u6587\u7ae0\u7684\u7b2c [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[290,217,289],"class_list":["post-709","post","type-post","status-publish","format-standard","hentry","category-daily","tag-mxnet","tag-python","tag-289"],"_links":{"self":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/709","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=709"}],"version-history":[{"count":0,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=\/wp\/v2\/posts\/709\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=709"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=709"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.5danyuan.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=709"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}