{"id":16460,"date":"2020-09-08T12:10:13","date_gmt":"2020-09-08T04:10:13","guid":{"rendered":"https:\/\/blog.tibame.com\/?p=16460"},"modified":"2022-04-08T18:12:05","modified_gmt":"2022-04-08T10:12:05","slug":"%e6%b7%b1%e5%ba%a6%e5%ad%b8%e7%bf%92%e6%a1%86%e6%9e%b6%e4%b9%8b%e6%88%b0","status":"publish","type":"post","link":"https:\/\/blog.tibame.com\/?p=16460","title":{"rendered":"\u6df1\u5ea6\u5b78\u7fd2\u6846\u67b6\u4e4b\u6230"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\"><strong>\u4e3b\u8981\u7af6\u722d\u8005\uff1aPyTorch\u548cTensorFlow<\/strong><\/h2>\n\n\n\n<p>\u7528TensorFlow\u9084\u662fPyTorch\uff1f\u5f9eTensorFlow\u958b\u59cb\u5b78\u8d77\u9084\u662fPyTorch\uff1f<\/p>\n\n\n\n<p>\u5728\u5e7e\u5e74\u524d\uff0c\u9019\u500b\u554f\u984c\u6beb\u7121\u7591\u554f\uff0c\u7576\u7136\u662fTensorFlow\uff0c\u4f46\u6642\u4ee3\u4e0d\u540c\uff0c\u73fe\u5728\u7684\u60c5\u6cc1\u4e5f\u4e0d\u4e00\u6a23\u4e86\u3002<\/p>\n\n\n\n<p>\u6df1\u5ea6\u5b78\u7fd2\u6846\u67b6(deep learning framework)\u70ba\u73fe\u968e\u6bb5\u4eba\u5de5\u667a\u6167\u7684\u7af6\u722d\u91cd\u9ede\uff0c\u5176\u4e2d\uff0cGoogle\u7684TensorFlow\u96d6\u5728\u7522\u696d\u8655\u65bc\u9818\u5148\u5730\u4f4d\uff0c\u4f462017\u5e74\u521d Facebook\u63a8\u51fa\u4e86\u5168\u65b0\u7684\u6df1\u5ea6\u5b78\u7fd2\u6846\u67b6-PyTorch\u5176\u4e2d\uff0cPyTorch\u5177\u7c21\u6f54\u3001\u5feb\u901f\u958b\u767c\u80fd\u529b\uff0c\u6df1\u53d7\u5b78\u8853\u5e02\u5834\u9752\u775e\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<p>\u96a8\u8457 PyTorch \u7684\u554f\u4e16\u4ee5\u53ca ONNX (Open Neural Network Exchange) \u6df1\u5ea6\u5b78\u7fd2\u958b\u767c\u751f\u614b\u7684\u9010\u6f38\u5b8c\u6574\uff0cPytorch\u7121\u7591\u6210\u70ba\u8a31\u591a\u6df1\u5ea6\u5b78\u7fd2\u67b6\u69cb\u4e2d\u503c\u5f97\u671f\u5f85\u7684\u660e\u65e5\u4e4b\u661f\u3002<\/p>\n\n\n\n<p>PyTorch\u7684\u524d\u8eab Torch\u662f\u7528Lua\u5beb\u7684\u6a5f\u5668\u5b78\u7fd2\u67b6\u69cb\uff0c\u5f8c\u4f86\u53d7\u5230Facebook\uff0cNVIDIA\uff0cUber\u7b49\u5927\u516c\u53f8\u7684\u652f\u63f4\u4e0b\u6f38\u6f38\u767c\u5c55\u8d77\u4f86\uff0c\u4f46\u73fe\u6709\u7684\u6df1\u5ea6\u5b78\u7fd2\u67b6\u69cb\u537b\u8655\u8655\u7684\u7c21\u5316\u5462 ? \u4f8b\u5982\u5716\u7247\u56fa\u5b9a\u7684\u5927\u5c0f\u3001\u53e5\u5b50\u56fa\u5b9a\u7684\u9577\u5ea6\u3002<\/p>\n\n\n\n<p>\u5982\u679c\u4f60\u5c0d\u65bc\u9019\u7a2e\u675f\u7e1b\u611f\u5230\u53ad\u5026\uff0c\u90a3\u9ebc<strong>\u4f7f\u7528\u52d5\u614b\u8a08\u7b97\u5716\u7684PyTorch<\/strong>\u53ef\u80fd\u6703\u662f\u6700\u597d\u7684\u9078\u64c7\uff01<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<p>\u5728\u4eba\u5de5\u667a\u6167\u7684\u6642\u4ee3\uff0cTensorFlow\u5df2\u7d93\u6210\u70ba\u6df1\u5ea6\u5b78\u7fd2\u958b\u767c\u7684\u4e3b\u6d41\u7a0b\u5f0f\u5eab\uff0c\u5176\u529f\u80fd\u5f37\u5927\uff0c\u904b\u7b97\u6548\u7387\u9ad8\uff0c\u652f\u63f4\u591a\u500b\u5e73\u53f0\uff0c\u5df2\u7d93\u958b\u59cb\u5ee3\u6cdb\u7684\u4f7f\u7528\uff0c\u4e0d\u904eTensorFlow 1.x\u7248\u7684\u5b78\u7fd2\u9580\u6abb\u9ad8\uff0c\u5c0d\u525b\u5165\u9580\u7684\u521d\u5b78\u8005\u76f8\u7576\u96e3\u4e0a\u624b\uff0c\u9019\u4e9b\u554f\u984c\uff0cGoogle\u5718\u968a\u57282019\u5e74\u521d\u63a8\u51fa\u4e86TensorFlow 2.0\u7248\uff0cTensorFlow 2.0 \u5f15\u5165\u4e86 Eager Execution\u52d5\u614b\u5716\u6a21\u5f0f\uff0cKeras API\u53ca tf.data\u7b49\u529f\u80fd\uff0c\u4e0d\u4f46\u8b93\u5b78\u7fd2\u9580\u6abb\u5927\u5e45\u964d\u4f4e\uff0c\u4e5f\u8b8a\u5f97\u66f4\u52a0\u89aa\u6c11\u3002<\/p>\n\n\n\n<p>\u73fe\u968e\u6bb5\u8a31\u591a\u4eba\u6b63\u5728\u653e\u68c4TensorFlow\uff0c\u4e26\u5927\u91cf\u6295\u5411PyTorch\u7684\u61f7\u62b1\u3002<\/p>\n\n\n\n<p>\u70ba\u4ec0\u9ebc\u559c\u6b61PyTorch\uff1f<\/p>\n\n\n\n<p>\u7c21\u55ae\u4f86\u8aaa\u3002\u5b83\u985e\u4f3c\u65bcnumpy\uff0c\u975e\u5e38\u5177\u6709python\u98a8\u683c\uff0c\u4e26\u4e14\u53ef\u4ee5\u8f15\u9b06\u5730\u8207Python\u751f\u614b\u7cfb\u7d71\u7684\u505a\u6574\u5408\u3002 <\/p>\n\n\n\n<p>\u8207TensorFlow\u7684API\u76f8\u6bd4\uff0cPyTorch\u7684API\u66f4\u8a0e\u559c\u3002\u662f\u56e0\u70baPyTorch\u7684\u8a2d\u8a08\u66f4\u597d\uff0c\u90e8\u5206\u539f\u56e0\u662fTensorFlow\u901a\u904e\u591a\u6b21\u5207\u63dbAPI\u800c\u640d\u5931\u4e86\u6548\u80fd\u3002\u5118\u7ba1\u4e8b\u5be6\u4e0aPyTorch\u7684\u52d5\u614b\u5716\u63d0\u4f9b\u7684\u512a\u5316\u6a5f\u6703\u5f88\u5c11\uff0c\u4f46\u6709\u8a31\u591a\u50b3\u805e\u7a31PyTorch\u7684\u901f\u5ea6\u751a\u81f3\u5feb\u65bcTensorFlow\u3002\u76ee\u524d\u80fd\u4e0d\u6e05\u695a\u9019\u662f\u5426\u771f\u7684\u6210\u7acb\uff0c\u4f46\u81f3\u5c11\uff0cTensorFlow\u5728\u9019\u4e00\u9818\u57df\u9084\u6c92\u6709\u8f03\u5927\u7684\u512a\u52e2\u3002<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<p>\u5118\u7ba1PyTorch\u73fe\u5728\u5728\u7814\u7a76\u4e2d\u8655\u65bc\u4e3b\u5c0e\u5730\u4f4d\uff0c\u4f46\u7522\u696d\u754c\u8868\u660eTensorFlow\u4f9d\u7136\u662f\u4e3b\u5c0e\u6846\u67b6\u3002\u4e3b\u8981\u662f\u80fd\u5920\u5728\u8f03\u5c0f\u7684\u8cc7\u6599\u96c6\u4e0a\u8ddfGPU\u57f7\u884c\u7684\uff0c\u53e6\u4e00\u65b9\u9762\uff0c\u5de5\u696d\u884c\u696d\u6709\u5f88\u591a\u9650\u5236\u8981\u6c42\u3002\u670d\u52d9\u4e0a\u4f86\u770b \u529f\u80fd\u5168\u9762\uff0c\u4f8b\u5982\u7121\u505c\u6a5f\u66f4\u65b0\u6a21\u578b\uff0c\u5728\u6a21\u578b\u4e4b\u9593\u7121\u7e2b\u5207\u63db\uff0c\u5728\u9810\u6e2c\u6642\u9032\u884c\u6279\u6b21\u8655\u7406\u7b49\u3002<\/p>\n\n\n\n<p>TensorFlow\u662f\u5c08\u9580\u91dd\u5c0d\u9019\u4e9b\u8981\u6c42\u800c\u69cb\u5efa\u7684\uff0c\u7232\u6240\u6709\u9019\u4e9b\u554f\u984c\u63d0\u4f9b\u4e86\u89e3\u6c7a\u65b9\u6848\uff1a\u5716\u5f62\u683c\u5f0f\u548c\u57f7\u884c\u5f15\u64ce\u672c\u4f86\u5c31\u4e0d\u9700\u8981Python\uff0c\u73fe\u968e\u6bb5PyTorch\u672a\u80fd\u6eff\u8db3\u9019\u4e9b\u7591\u616e\uff0c\u56e0\u6b64\u5927\u591a\u6578\u516c\u53f8\u76ee\u524d\u5728\u5de5\u4f5c\u4e2d\u4ecd\u4f7f\u7528TensorFlow\u3002\u56e0\u6b64\uff0c\u6211\u5011\u80fd\u4e86\u89e3\u6846\u67b6\u7684\u7576\u524d\u72c0\u614b\u3002PyTorch\u64c1\u6709\u7814\u7a76\u5e02\u5834\uff0c\u4e26\u4e14\u6b63\u5728\u5617\u8a66\u5c07\u9019\u4e00\u6210\u529f\u64f4\u5145\u5957\u4ef6\u5230\u5de5\u696d\u9818\u57df\u3002TensorFlow\u8a66\u5716\u5728\u4e0d\u72a7\u7272\u592a\u591a\u751f\u7522\u80fd\u529b\u7684\u60c5\u6cc1\u4e0b\uff0c\u5728\u7814\u7a76\u754c\u4e2d\u76e1\u5176\u6240\u80fd\u3002PyTorch\u5c0d\u7522\u696d\u7522\u751f\u6709\u610f\u7fa9\u7684\u5f71\u97ff\u80af\u5b9a\u9700\u8981\u5f88\u9577\u6642\u9593 \u6240\u4ee5\uff0c\u4e0d\u7ba1\u4f60\u559c\u6b61TensorFlow\u9084\u662fPyTorch\uff0c\u76ee\u7684\u53ea\u6709\u4e00\u500b\uff0c\u5c31\u662f\u60f3\u8b93\u6df1\u5ea6\u5b78\u7fd2\u505a\u5230\u6700\u597d\u3002<\/p>\n\n\n\n<p>\u64b0\u6587\u8005: TibaMe AI\u4eba\u5de5\u667a\u6167\u8ab2\u7a0b\u7e3d\u76e3 Ryan <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7528TensorFlow\u9084\u662fPyTorch\uff1f\u5f9eTensorFlow\u958b\u59cb\u5b78\u8d77\u9084\u662fPyTorch\uff1f<\/p>\n<p>\u5728\u5e7e\u5e74\u524d\uff0c\u9019\u500b\u554f\u984c\u6beb\u7121\u7591\u554f\uff0c\u7576\u7136\u662fTensorFlow\uff0c\u4f46\u6642\u4ee3\u4e0d\u540c\uff0c\u73fe\u5728\u7684\u60c5\u6cc1\u4e5f\u4e0d\u4e00\u6a23\u4e86\u3002<\/p>\n<p>\u6df1\u5ea6\u5b78\u7fd2\u6846\u67b6(deep learning framework)\u70ba\u73fe\u968e\u6bb5\u4eba\u5de5\u667a\u6167\u7684\u7af6\u722d\u91cd\u9ede\uff0c\u5176\u4e2d\uff0cGoogle\u7684TensorFlow\u96d6\u5728\u7522\u696d\u8655\u65bc\u9818\u5148\u5730\u4f4d\uff0c\u4f462017\u5e74\u521d Facebook\u63a8\u51fa\u4e86\u5168\u65b0\u7684\u6df1\u5ea6\u5b78\u7fd2\u6846\u67b6-PyTorch\u5176\u4e2d\uff0cPyTorch\u5177\u7c21\u6f54\u3001\u5feb\u901f\u958b\u767c\u80fd\u529b\uff0c\u6df1\u53d7\u5b78\u8853\u5e02\u5834\u9752\u775e\u3002<\/p>\n","protected":false},"author":19,"featured_media":16838,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[480,1196,173],"tags":[1097,1098,353,678,679,1095,1096],"class_list":["post-16460","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology","category-ai-","category-173","tag-pytorch","tag-1098","tag-353","tag-678","tag-679","tag-keras-api","tag-tensorflow"],"aioseo_notices":[],"views":2502,"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/posts\/16460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/users\/19"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=16460"}],"version-history":[{"count":4,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/posts\/16460\/revisions"}],"predecessor-version":[{"id":16840,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/posts\/16460\/revisions\/16840"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=\/wp\/v2\/media\/16838"}],"wp:attachment":[{"href":"https:\/\/blog.tibame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=16460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=16460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.tibame.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=16460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}