{"id":784,"date":"2024-06-06T20:26:30","date_gmt":"2024-06-06T12:26:30","guid":{"rendered":"http:\/\/madapapa.com\/wordpress\/?p=784"},"modified":"2024-06-06T20:27:20","modified_gmt":"2024-06-06T12:27:20","slug":"hua-weiascend-npu-shi-pei","status":"publish","type":"post","link":"http:\/\/madapapa.com\/wordpress\/?p=784","title":{"rendered":"\u534e\u4e3aAscend NPU\u9002\u914d"},"content":{"rendered":"<h1><a id=\"ascend-extension-for-pytorch%E6%8F%92%E4%BB%B6\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>Ascend Extension for PyTorch\u63d2\u4ef6<\/h1>\n<h2><a id=\"%E7%AE%80%E4%BB%8B\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u7b80\u4ecb<\/h2>\n<p>\u672c\u9879\u76ee\u5f00\u53d1\u4e86\u540d\u4e3a<strong>torch_npu<\/strong>\u7684<strong>Ascend Extension for PyTorch<\/strong>\u63d2\u4ef6\uff0c\u4f7f\u6607\u817eNPU\u53ef\u4ee5\u9002\u914dPyTorch\u6846\u67b6\uff0c\u4e3a\u4f7f\u7528PyTorch\u6846\u67b6\u7684\u5f00\u53d1\u8005\u63d0\u4f9b\u6607\u817eAI\u5904\u7406\u5668\u7684\u8d85\u5f3a\u7b97\u529b\u3002<\/p>\n<p>\u6607\u817e\u4e3a\u57fa\u4e8e\u534e\u4e3a\u6607\u817e\u5904\u7406\u5668\u548c\u8f6f\u4ef6\u7684\u884c\u4e1a\u5e94\u7528\u53ca\u670d\u52a1\u63d0\u4f9b\u5168\u6808AI\u8ba1\u7b97\u57fa\u7840\u8bbe\u65bd\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee<a href=\"https:\/\/www.hiascend.com\/zh\/\">\u6607\u817e\u793e\u533a<\/a>\uff0c\u4e86\u89e3\u5173\u4e8e\u6607\u817e\u7684\u66f4\u591a\u4fe1\u606f\u3002<\/p>\n<h2><a id=\"%E5%AE%89%E8%A3%85\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5b89\u88c5<\/h2>\n<h3><a id=\"%E4%BD%BF%E7%94%A8%E4%BA%8C%E8%BF%9B%E5%88%B6%E6%96%87%E4%BB%B6%E8%BF%9B%E8%A1%8C%E5%AE%89%E8%A3%85\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u4f7f\u7528\u4e8c\u8fdb\u5236\u6587\u4ef6\u8fdb\u884c\u5b89\u88c5<\/h3>\n<p>\u6211\u4eec\u4e3a\u7528\u6237\u63d0\u4f9b\u53ef\u4ee5\u5feb\u901f\u5b89\u88c5<strong>torch_npu<\/strong>\u7684whl\u5b89\u88c5\u5305\u3002\u5728\u5b89\u88c5<strong>torch_npu<\/strong>\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5148\u5b89\u88c5<strong>CANN<\/strong>\u8f6f\u4ef6\u3002<a href=\"#%E6%98%87%E8%85%BE%E8%BE%85%E5%8A%A9%E8%BD%AF%E4%BB%B6\">\u6607\u817e\u8f85\u52a9\u8f6f\u4ef6<\/a>\u4e2d\u6709\u66f4\u591a\u5173\u4e8eCANN\u7684\u7248\u672c\u4fe1\u606f\u3002\u8bf7\u53c2\u8003<a href=\"https:\/\/www.hiascend.com\/zh\/software\/cann\/community\">CANN\u5b89\u88c5\u6307\u5357<\/a>\u83b7\u53d6<strong>CANN<\/strong>\u5b89\u88c5\u5305\u3002<\/p>\n<ol>\n<li><strong>\u5b89\u88c5PyTorch<\/strong><\/li>\n<\/ol>\n<p>\u901a\u8fc7 pip \u5b89\u88c5 PyTorch\u3002<\/p>\n<p><strong>aarch64:<\/strong><\/p>\n<pre><code class=\"language-Python\">pip3 install torch==2.1.0\n<\/code><\/pre>\n<p><strong>x86:<\/strong><\/p>\n<pre><code class=\"language-Python\">pip3 install torch==2.1.0+cpu  --index-url https:\/\/download.pytorch.org\/whl\/cpu\n<\/code><\/pre>\n<p>\u82e5\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5\u5931\u8d25\uff0c\u8bf7\u4f7f\u7528\u4e0b\u8f7d\u94fe\u63a5\u6216\u8fdb\u5165<a href=\"https:\/\/pytorch.org\/\">PyTorch\u5b98\u65b9\u7f51\u7ad9<\/a>\u8fdb\u884c\u67e5\u8be2\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u67b6\u6784<\/th>\n<th>Python\u7248\u672c<\/th>\n<th>\u4e0b\u8f7d\u94fe\u63a5<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>x86<\/td>\n<td>Python3.8<\/td>\n<td><a href=\"https:\/\/download.pytorch.org\/whl\/cpu\/torch-2.1.0%2Bcpu-cp38-cp38-linux_x86_64.whl#sha256=9e5cfd931a65b38d222755a45dabb53b836be31bc620532bc66fee77e3ff67dc\">\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>Python3.9<\/td>\n<td><a href=\"https:\/\/download.pytorch.org\/whl\/cpu\/torch-2.1.0%2Bcpu-cp39-cp39-linux_x86_64.whl#sha256=86cc28df491fa84738affe752f9870791026565342f69e4ab63e5b935f00a495\">\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<tr>\n<td>x86<\/td>\n<td>Python3.10<\/td>\n<td><a href=\"https:\/\/download.pytorch.org\/whl\/cpu\/torch-2.1.0%2Bcpu-cp310-cp310-linux_x86_64.whl#sha256=5077921fc2b54e69a534f3a9c0b98493c79a5547c49d46f5e77e42da3610e011\">\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<tr>\n<td>aarch64<\/td>\n<td>Python3.8<\/td>\n<td><a href=\"https:\/\/download.pytorch.org\/whl\/cpu\/torch-2.1.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl#sha256=761822761fffaa1c18a62c5deb13abaa780862577d3eadc428f1daa632536905\">\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<tr>\n<td>aarch64<\/td>\n<td>Python3.9<\/td>\n<td><a href=\"https:\/\/download.pytorch.org\/whl\/cpu\/torch-2.1.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl#sha256=de7d63c6ecece118684415a3dbd4805af4a4c1ee1490cccf7405d8c240a481b4\">\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<tr>\n<td>aarch64<\/td>\n<td>Python3.10<\/td>\n<td><a href=\"https:\/\/download.pytorch.org\/whl\/cpu\/torch-2.1.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl#sha256=a04a0296d47f28960f51c18c5489a8c3472f624ec3b5bcc8e2096314df8c3342\">\u4e0b\u8f7d\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<ol start=\"2\">\n<li><strong>\u5b89\u88c5torch_npu\u4f9d\u8d56<\/strong><\/li>\n<\/ol>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u4f9d\u8d56\u3002<\/p>\n<pre><code class=\"language-Python\">pip3 install pyyaml\npip3 install setuptools\n<\/code><\/pre>\n<ol start=\"3\">\n<li><strong>\u5b89\u88c5torch_npu<\/strong><\/li>\n<\/ol>\n<pre><code class=\"language-plain_text\">pip3 install torch-npu==2.1.0.post3\n<\/code><\/pre>\n<p>\u5982\u9700\u8981\u4fdd\u5b58\u5b89\u88c5\u65e5\u5fd7\uff0c\u53ef\u5728pip3 install\u547d\u4ee4\u540e\u9762\u52a0\u4e0a\u53c2\u6570 <code>--log &lt;PATH&gt;<\/code>\uff0c\u5e76\u5bf9\u60a8\u6307\u5b9a\u7684\u76ee\u5f55<code>&lt;PATH&gt;<\/code>\u505a\u597d\u6743\u9650\u7ba1\u63a7\u3002<\/p>\n<h3><a id=\"%E4%BD%BF%E7%94%A8%E6%BA%90%E4%BB%A3%E7%A0%81%E8%BF%9B%E8%A1%8C%E5%AE%89%E8%A3%85\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u4f7f\u7528\u6e90\u4ee3\u7801\u8fdb\u884c\u5b89\u88c5<\/h3>\n<p>\u67d0\u4e9b\u7279\u6b8a\u573a\u666f\u4e0b\uff0c\u7528\u6237\u53ef\u80fd\u9700\u8981\u81ea\u884c\u7f16\u8bd1<strong>torch_npu<\/strong>\u3002\u53ef\u4ee5\u6839\u636e<a href=\"#%E6%98%87%E8%85%BE%E8%BE%85%E5%8A%A9%E8%BD%AF%E4%BB%B6\">\u6607\u817e\u8f85\u52a9\u8f6f\u4ef6\u8868<\/a>\u548c<a href=\"#PyTorch%E4%B8%8EPython%E7%89%88%E6%9C%AC%E9%85%8D%E5%A5%97%E8%A1%A8\">PyTorch\u4e0ePython\u7248\u672c\u914d\u5957\u8868<\/a>\u9009\u62e9\u5408\u9002\u7684\u5206\u652f\u3002\u63a8\u8350\u4f7f\u7528Docker\u955c\u50cf\u7f16\u8bd1<strong>torch_npu<\/strong>\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u83b7\u53d6(\u5efa\u8bae\u53ea\u6302\u8f7d\u5de5\u4f5c\u8def\u5f84\uff0c\u5e76\u907f\u5f00\u7cfb\u7edf\u8def\u5f84\uff0c\u4ee5\u964d\u4f4e\u5b89\u5168\u98ce\u9669), \u751f\u6210\u7684.whl\u6587\u4ef6\u8def\u5f84\u4e3a.\/dist\/\uff1a<\/p>\n<ol>\n<li>\n<p><strong>\u514b\u9686torch_npu\u4ee3\u7801\u4ed3<\/strong><\/p>\n<pre><code class=\"language-plain_text\">git clone https:\/\/gitee.com\/ascend\/pytorch.git -b v2.1.0-6.0.rc1 --depth 1\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u6784\u5efa\u955c\u50cf<\/strong><\/p>\n<pre><code class=\"language-plain_text\">cd pytorch\/ci\/docker\/{arch} # {arch} for X86 or ARM\ndocker build -t manylinux-builder:v1 .\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u8fdb\u5165Docker\u5bb9\u5668<\/strong><\/p>\n<pre><code class=\"language-plain_text\">docker run -it -v \/{code_path}\/pytorch:\/home\/pytorch manylinux-builder:v1 bash\n# {code_path} is the torch_npu source code path\n<\/code><\/pre>\n<\/li>\n<li>\n<p><strong>\u7f16\u8bd1torch_npu<\/strong><\/p>\n<p>\u4ee5<strong>Python 3.8<\/strong> \u4e3a\u4f8b\u3002<\/p>\n<pre><code class=\"language-plain_text\">cd \/home\/pytorch\nbash ci\/build.sh --python=3.8\n<\/code><\/pre>\n<\/li>\n<\/ol>\n<h2><a id=\"%E5%8D%B8%E8%BD%BD\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5378\u8f7d<\/h2>\n<p>Pytorch\u6846\u67b6\u8bad\u7ec3\u73af\u5883\u7684\u5378\u8f7d\u53ef\u4ee5\u53c2\u8003<a href=\"https:\/\/www.hiascend.com\/document\/detail\/zh\/ModelZoo\/pytorchframework\/ptes\/ptes_00032.html\">\u6607\u817e\u5b98\u65b9\u6587\u6863<\/a>\u3002<\/p>\n<p>torch_npu\u7684\u5378\u8f7d\u53ea\u9700\u6267\u884c\u547d\u4ee4\uff1a<\/p>\n<pre><code class=\"language-plain_text\">pip3 uninstall torch_npu\n<\/code><\/pre>\n<p>\u5982\u9700\u8981\u4fdd\u5b58\u5378\u8f7d\u65e5\u5fd7\uff0c\u53ef\u5728pip3 uninstall\u547d\u4ee4\u540e\u9762\u52a0\u4e0a\u53c2\u6570 <code>--log &lt;PATH&gt;<\/code>\uff0c\u5e76\u5bf9\u60a8\u6307\u5b9a\u7684\u76ee\u5f55<code>&lt;PATH&gt;<\/code>\u505a\u597d\u6743\u9650\u7ba1\u63a7\u3002<\/p>\n<h2><a id=\"%E5%85%A5%E9%97%A8\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5165\u95e8<\/h2>\n<h3><a id=\"%E5%89%8D%E6%8F%90\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u524d\u63d0<\/h3>\n<p>\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u521d\u59cb\u5316<strong>CANN<\/strong>\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<pre><code class=\"language-Shell\"># Default path, change it if needed.\nsource \/usr\/local\/Ascend\/ascend-toolkit\/set_env.sh\n<\/code><\/pre>\n<h3><a id=\"%E5%BF%AB%E9%80%9F%E9%AA%8C%E8%AF%81\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5feb\u901f\u9a8c\u8bc1<\/h3>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6837\u4f8b\u5feb\u901f\u4f53\u9a8c<strong>\u6607\u817eNPU<\/strong>\u3002<\/p>\n<pre><code class=\"language-Python\">import torch\nimport torch_npu\n\nx = torch.randn(2, 2).npu()\ny = torch.randn(2, 2).npu()\nz = x.mm(y)\n\nprint(z)\n<\/code><\/pre>\n<h2><a id=\"pytorch%E4%B8%8Epython%E7%89%88%E6%9C%AC%E9%85%8D%E5%A5%97%E8%A1%A8\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>PyTorch\u4e0ePython\u7248\u672c\u914d\u5957\u8868<\/h2>\n<table>\n<thead>\n<tr>\n<th>PyTorch\u7248\u672c<\/th>\n<th style=\"text-align: left\">Python\u7248\u672c<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>PyTorch1.11.0<\/td>\n<td style=\"text-align: left\">Python3.7.x(&gt;=3.7.5), Python3.8.x, Python3.9.x, Python3.10.x<\/td>\n<\/tr>\n<tr>\n<td>PyTorch2.1.0<\/td>\n<td style=\"text-align: left\">Python3.8.x, Python3.9.x, Python3.10.x<\/td>\n<\/tr>\n<tr>\n<td>PyTorch2.2.0<\/td>\n<td style=\"text-align: left\">Python3.8.x, Python3.9.x, Python3.10.x<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><a id=\"%E6%98%87%E8%85%BE%E8%BE%85%E5%8A%A9%E8%BD%AF%E4%BB%B6\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u6607\u817e\u8f85\u52a9\u8f6f\u4ef6<\/h2>\n<p><strong>PyTorch Extension<\/strong>\u7248\u672c\u53f7\u91c7\u7528<code>{PyTorch\u7248\u672c}-{\u6607\u817e\u7248\u672c}<\/code>\u547d\u540d\u89c4\u5219\uff0c\u524d\u8005\u4e3a<strong>PyTorch Extension<\/strong>\u5339\u914d\u7684PyTorch\u7248\u672c\uff0c\u540e\u8005\u7528\u4e8e\u5339\u914dCANN\u7248\u672c\uff0c\u8be6\u7ec6\u5339\u914d\u5982\u4e0b\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>CANN\u7248\u672c<\/th>\n<th>\u652f\u6301\u7684PyTorch\u7248\u672c<\/th>\n<th>\u652f\u6301\u7684Extension\u7248\u672c<\/th>\n<th>Gitee\u5206\u652f<\/th>\n<th>AscendHub\u955c\u50cf\u7248\u672c\/\u540d\u79f0(<a href=\"https:\/\/ascendhub.huawei.com\/#\/detail\/pytorch-modelzoo\">\u94fe\u63a5<\/a>)<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>CANN 8.0.RC1<\/td>\n<td>2.2.0<\/td>\n<td>2.2.0<\/td>\n<td>v2.2.0-6.0.rc1<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>2.1.0<\/td>\n<td>2.1.0.post3<\/td>\n<td>v2.1.0-6.0.rc1<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.11.0<\/td>\n<td>1.11.0.post11<\/td>\n<td>v1.11.0-6.0.rc1<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 7.0.0<\/td>\n<td>2.1.0<\/td>\n<td>2.1.0<\/td>\n<td>v2.1.0-5.0.0<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>2.0.1<\/td>\n<td>2.0.1.post1<\/td>\n<td>v2.0.1-5.0.0<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.11.0<\/td>\n<td>1.11.0.post8<\/td>\n<td>v1.11.0-5.0.0<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 7.0.RC1<\/td>\n<td>2.1.0<\/td>\n<td>2.1.0.rc1<\/td>\n<td>v2.1.0-5.0.rc3<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>2.0.1<\/td>\n<td>2.0.1<\/td>\n<td>v2.0.1-5.0.rc3<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.11.0<\/td>\n<td>1.11.0.post4<\/td>\n<td>v1.11.0-5.0.rc3<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 6.3.RC3.1<\/td>\n<td>1.11.0<\/td>\n<td>1.11.0.post3<\/td>\n<td>v1.11.0-5.0.rc2.2<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 6.3.RC3<\/td>\n<td>1.11.0<\/td>\n<td>1.11.0.post2<\/td>\n<td>v1.11.0-5.0.rc2.1<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 6.3.RC2<\/td>\n<td>2.0.1<\/td>\n<td>2.0.1.rc1<\/td>\n<td>v2.0.1-5.0.rc2<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.11.0<\/td>\n<td>1.11.0.post1<\/td>\n<td>v1.11.0-5.0.rc2<\/td>\n<td>23.0.RC1-1.11.0<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.8.1<\/td>\n<td>1.8.1.post2<\/td>\n<td>v1.8.1-5.0.rc2<\/td>\n<td>23.0.RC1-1.8.1<\/td>\n<\/tr>\n<tr>\n<td>CANN 6.3.RC1<\/td>\n<td>1.11.0<\/td>\n<td>1.11.0<\/td>\n<td>v1.11.0-5.0.rc1<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.8.1<\/td>\n<td>1.8.1.post1<\/td>\n<td>v1.8.1-5.0.rc1<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 6.0.1<\/td>\n<td>1.5.0<\/td>\n<td>1.5.0.post8<\/td>\n<td>v1.5.0-3.0.0<\/td>\n<td>22.0.0<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.8.1<\/td>\n<td>1.8.1<\/td>\n<td>v1.8.1-3.0.0<\/td>\n<td>22.0.0-1.8.1<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.11.0<\/td>\n<td>1.11.0.rc2\uff08beta)<\/td>\n<td>v1.11.0-3.0.0<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 6.0.RC1<\/td>\n<td>1.5.0<\/td>\n<td>1.5.0.post7<\/td>\n<td>v1.5.0-3.0.rc3<\/td>\n<td>22.0.RC3<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.8.1<\/td>\n<td>1.8.1.rc3<\/td>\n<td>v1.8.1-3.0.rc3<\/td>\n<td>22.0.RC3-1.8.1<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.11.0<\/td>\n<td>1.11.0.rc1\uff08beta)<\/td>\n<td>v1.11.0-3.0.rc3<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 5.1.RC2<\/td>\n<td>1.5.0<\/td>\n<td>1.5.0.post6<\/td>\n<td>v1.5.0-3.0.rc2<\/td>\n<td>22.0.RC2<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.8.1<\/td>\n<td>1.8.1.rc2<\/td>\n<td>v1.8.1-3.0.rc2<\/td>\n<td>22.0.RC2-1.8.1<\/td>\n<\/tr>\n<tr>\n<td>CANN 5.1.RC1<\/td>\n<td>1.5.0<\/td>\n<td>1.5.0.post5<\/td>\n<td>v1.5.0-3.0.rc1<\/td>\n<td>22.0.RC1<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>1.8.1<\/td>\n<td>1.8.1.rc1<\/td>\n<td>v1.8.1-3.0.rc1<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<tr>\n<td>CANN 5.0.4<\/td>\n<td>1.5.0<\/td>\n<td>1.5.0.post4<\/td>\n<td>2.0.4.tr5<\/td>\n<td>21.0.4<\/td>\n<\/tr>\n<tr>\n<td>CANN 5.0.3<\/td>\n<td>1.8.1<\/td>\n<td>1.5.0.post3<\/td>\n<td>2.0.3.tr5<\/td>\n<td>21.0.3<\/td>\n<\/tr>\n<tr>\n<td>CANN 5.0.2<\/td>\n<td>1.5.0<\/td>\n<td>1.5.0.post2<\/td>\n<td>2.0.2.tr5<\/td>\n<td>21.0.2<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><a id=\"%E5%BB%BA%E8%AE%AE%E4%B8%8E%E4%BA%A4%E6%B5%81\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5efa\u8bae\u4e0e\u4ea4\u6d41<\/h2>\n<p>\u6b22\u8fce\u5927\u5bb6\u4e3a\u793e\u533a\u505a\u8d21\u732e\u3002\u5982\u679c\u6709\u4efb\u4f55\u7591\u95ee\u6216\u5efa\u8bae\uff0c\u8bf7\u63d0\u4ea4<a href=\"https:\/\/gitee.com\/Ascend\/pytorch\/issues\">gitee Issues<\/a>\uff0c\u6211\u4eec\u4f1a\u5c3d\u5feb\u56de\u590d\u3002\u611f\u8c22\u60a8\u7684\u652f\u6301\u3002<\/p>\n<h2><a id=\"%E5%88%86%E6%94%AF%E7%BB%B4%E6%8A%A4%E7%AD%96%E7%95%A5\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5206\u652f\u7ef4\u62a4\u7b56\u7565<\/h2>\n<p>AscendPyTorch\u7248\u672c\u5206\u652f\u7684\u7ef4\u62a4\u9636\u6bb5\u5982\u4e0b\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th><strong>\u72b6\u6001<\/strong><\/th>\n<th><strong>\u65f6\u95f4<\/strong><\/th>\n<th><strong>\u8bf4\u660e<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u8ba1\u5212<\/td>\n<td>1\u20143 \u4e2a\u6708<\/td>\n<td>\u8ba1\u5212\u7279\u6027<\/td>\n<\/tr>\n<tr>\n<td>\u5f00\u53d1<\/td>\n<td>3 \u4e2a\u6708<\/td>\n<td>\u5f00\u53d1\u7279\u6027<\/td>\n<\/tr>\n<tr>\n<td>\u7ef4\u62a4<\/td>\n<td>6-12 \u4e2a\u6708<\/td>\n<td>\u5408\u5165\u6240\u6709\u5df2\u89e3\u51b3\u7684\u95ee\u9898\u5e76\u53d1\u5e03\u7248\u672c\uff0c\u9488\u5bf9\u4e0d\u540c\u7684PyTorch\u7248\u672c\u91c7\u53d6\u4e0d\u540c\u7684\u7ef4\u62a4\u7b56\u7565\uff0c\u5e38\u89c4\u7248\u672c\u548c\u957f\u671f\u652f\u6301\u7248\u672c\u7ef4\u62a4\u5468\u671f\u5206\u522b\u4e3a6\u4e2a\u6708\u548c12\u4e2a\u6708<\/td>\n<\/tr>\n<tr>\n<td>\u65e0\u7ef4\u62a4<\/td>\n<td>0\u20143 \u4e2a\u6708<\/td>\n<td>\u5408\u5165\u6240\u6709\u5df2\u89e3\u51b3\u7684\u95ee\u9898\uff0c\u65e0\u4e13\u804c\u7ef4\u62a4\u4eba\u5458\uff0c\u65e0\u7248\u672c\u53d1\u5e03<\/td>\n<\/tr>\n<tr>\n<td>\u751f\u547d\u5468\u671f\u7ec8\u6b62\uff08EOL\uff09<\/td>\n<td>N\/A<\/td>\n<td>\u5206\u652f\u4e0d\u518d\u63a5\u53d7\u4efb\u4f55\u4fee\u6539<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><a id=\"pytorch%E7%89%88%E6%9C%AC%E7%BB%B4%E6%8A%A4%E7%AD%96%E7%95%A5\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>PyTorch\u7248\u672c\u7ef4\u62a4\u7b56\u7565<\/h2>\n<table>\n<thead>\n<tr>\n<th><strong>PyTorch\u7248\u672c<\/strong><\/th>\n<th><strong>\u7ef4\u62a4\u7b56\u7565<\/strong><\/th>\n<th><strong>\u5f53\u524d\u72b6\u6001<\/strong><\/th>\n<th><strong>\u53d1\u5e03\u65f6\u95f4<\/strong><\/th>\n<th><strong>\u540e\u7eed\u72b6\u6001<\/strong><\/th>\n<th><strong>EOL\u65e5\u671f<\/strong><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>2.2.0<\/td>\n<td>\u5e38\u89c4\u7248\u672c<\/td>\n<td>\u7ef4\u62a4<\/td>\n<td>2024\/04\/01<\/td>\n<td>\u9884\u8ba12024\/10\/15\u8d77\u65e0\u7ef4\u62a4<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>2.1.0<\/td>\n<td>\u957f\u671f\u652f\u6301<\/td>\n<td>\u7ef4\u62a4<\/td>\n<td>2023\/10\/15<\/td>\n<td>\u9884\u8ba12024\/10\/15\u8d77\u65e0\u7ef4\u62a4<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>2.0.1<\/td>\n<td>\u5e38\u89c4\u7248\u672c<\/td>\n<td>EOL<\/td>\n<td>2023\/7\/19<\/td>\n<td><\/td>\n<td>2024\/3\/14<\/td>\n<\/tr>\n<tr>\n<td>1.11.0<\/td>\n<td>\u957f\u671f\u652f\u6301<\/td>\n<td>\u7ef4\u62a4<\/td>\n<td>2023\/4\/19<\/td>\n<td>\u9884\u8ba12024\/4\/19\u8d77\u65e0\u7ef4\u62a4<\/td>\n<td><\/td>\n<\/tr>\n<tr>\n<td>1.8.1<\/td>\n<td>\u957f\u671f\u652f\u6301<\/td>\n<td>EOL<\/td>\n<td>2022\/4\/10<\/td>\n<td><\/td>\n<td>2023\/4\/10<\/td>\n<\/tr>\n<tr>\n<td>1.5.0<\/td>\n<td>\u957f\u671f\u652f\u6301<\/td>\n<td>EOL<\/td>\n<td>2021\/7\/29<\/td>\n<td><\/td>\n<td>2022\/7\/29<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><a id=\"%E5%AE%89%E5%85%A8%E5%A3%B0%E6%98%8E\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u5b89\u5168\u58f0\u660e<\/h2>\n<p><a href=\"https:\/\/gitee.com\/ascend\/pytorch\/blob\/master\/SECURITYNOTE.md\">Ascend Extension for PyTorch\u63d2\u4ef6 \u5b89\u5168\u58f0\u660e<\/a><\/p>\n<h2><a id=\"%E5%8F%82%E8%80%83%E6%96%87%E6%A1%A3\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u53c2\u8003\u6587\u6863<\/h2>\n<p>\u6709\u5173\u5b89\u88c5\u6307\u5357\u3001\u6a21\u578b\u8fc1\u79fb\u548c\u8bad\u7ec3\/\u63a8\u7406\u6559\u7a0b\u548cAPI\u5217\u8868\u7b49\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2\u8003<a href=\"https:\/\/www.hiascend.com\/software\/ai-frameworks\/commercial\">\u6607\u817e\u793e\u533aAscend Extension for PyTorch<\/a>\u3002<\/p>\n<table>\n<thead>\n<tr>\n<th>\u6587\u6863\u540d\u79f0<\/th>\n<th>\u6587\u6863\u94fe\u63a5<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>\u5b89\u88c5\u6307\u5357<\/td>\n<td><a href=\"https:\/\/www.hiascend.com\/document\/detail\/zh\/Pytorch\/60RC1\/quickstart\/instg\/instg_0163.html\">\u53c2\u8003\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<tr>\n<td>\u7f51\u7edc\u6a21\u578b\u8fc1\u79fb\u548c\u8bad\u7ec3<\/td>\n<td><a href=\"https:\/\/www.hiascend.com\/document\/detail\/zh\/Pytorch\/60RC1\/ptmoddevg\/trainingmigrguide\/PT_LMTMOG_0003.html\">\u53c2\u8003\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<tr>\n<td>\u7b97\u5b50\u9002\u914d<\/td>\n<td><a href=\"https:\/\/www.hiascend.com\/document\/detail\/zh\/canncommercial\/700\/operatordev\/tbeaicpudevg\/atlasopdev_10_0086.html\">\u53c2\u8003\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<tr>\n<td>API\u6e05\u5355\uff08PyTorch\u539f\u751f\u63a5\u53e3\u4e0e\u81ea\u5b9a\u4e49\u63a5\u53e3\uff09<\/td>\n<td><a href=\"https:\/\/www.hiascend.com\/document\/detail\/zh\/Pytorch\/60RC1\/apiref\/apilist\/ptaoplist_000002.html\">\u53c2\u8003\u94fe\u63a5<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2><a id=\"%E8%AE%B8%E5%8F%AF%E8%AF%81\" class=\"anchor\" aria-hidden=\"true\"><span class=\"octicon octicon-link\"><\/span><\/a>\u8bb8\u53ef\u8bc1<\/h2>\n<p>Ascend Extension for PyTorch\u63d2\u4ef6\u4f7f\u7528BSD\u8bb8\u53ef\u8bc1\u3002\u8be6\u89c1<a href=\"LICENSE\">LICENSE<\/a>\u6587\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ascend Extension for PyTorch\u63d2\u4ef6 \u7b80\u4ecb \u672c\u9879\u76ee\u5f00\u53d1\u4e86\u540d\u4e3atorch_npu\u7684Ascend Extension for PyTorch\u63d2\u4ef6\uff0c\u4f7f\u6607\u817eNPU\u53ef\u4ee5\u9002\u914dPyTorch\u6846\u67b6\uff0c\u4e3a\u4f7f\u7528PyTorch\u6846\u67b6\u7684\u5f00\u53d1\u8005\u63d0\u4f9b\u6607\u817eAI\u5904\u7406\u5668\u7684\u8d85\u5f3a\u7b97\u529b\u3002 \u6607\u817e\u4e3a\u57fa\u4e8e\u534e\u4e3a\u6607\u817e\u5904\u7406\u5668\u548c\u8f6f\u4ef6\u7684\u884c\u4e1a\u5e94\u7528\u53ca\u670d\u52a1\u63d0\u4f9b\u5168\u6808AI\u8ba1\u7b97\u57fa\u7840\u8bbe\u65bd\u3002\u60a8\u53ef\u4ee5\u901a\u8fc7\u8bbf\u95ee\u6607\u817e\u793e\u533a\uff0c\u4e86\u89e3\u5173\u4e8e\u6607\u817e\u7684\u66f4\u591a\u4fe1\u606f\u3002 \u5b89\u88c5 \u4f7f\u7528\u4e8c\u8fdb\u5236\u6587\u4ef6\u8fdb\u884c\u5b89\u88c5 \u6211\u4eec\u4e3a\u7528\u6237\u63d0\u4f9b\u53ef\u4ee5\u5feb\u901f\u5b89\u88c5torch_npu\u7684whl\u5b89\u88c5\u5305\u3002\u5728\u5b89\u88c5torch_npu\u4e4b\u524d\uff0c\u60a8\u9700\u8981\u5148\u5b89\u88c5CANN\u8f6f\u4ef6\u3002\u6607\u817e\u8f85\u52a9\u8f6f\u4ef6\u4e2d\u6709\u66f4\u591a\u5173\u4e8eCANN\u7684\u7248\u672c\u4fe1\u606f\u3002\u8bf7\u53c2\u8003CANN\u5b89\u88c5\u6307\u5357\u83b7\u53d6CANN\u5b89\u88c5\u5305\u3002 \u5b89\u88c5PyTorch \u901a\u8fc7 pip \u5b89\u88c5 PyTorch\u3002 aarch64: pip3 install torch==2.1.0 x86: pip3 install torch==2.1.0+cpu &#8211;index-url https:\/\/download.pytorch.org\/whl\/cpu \u82e5\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5\u5931\u8d25\uff0c\u8bf7\u4f7f\u7528\u4e0b\u8f7d\u94fe\u63a5\u6216\u8fdb\u5165PyTorch\u5b98\u65b9\u7f51\u7ad9\u8fdb\u884c\u67e5\u8be2\u4e0b\u8f7d\u5bf9\u5e94\u7248\u672c\u3002 \u67b6\u6784 Python\u7248\u672c \u4e0b\u8f7d\u94fe\u63a5 x86 Python3.8 \u4e0b\u8f7d\u94fe\u63a5 x86 Python3.9 \u4e0b\u8f7d\u94fe\u63a5 x86 Python3.10 \u4e0b\u8f7d\u94fe\u63a5 aarch64 Python3.8 \u4e0b\u8f7d\u94fe\u63a5 aarch64 Python3.9 \u4e0b\u8f7d\u94fe\u63a5 aarch64 Python3.10 \u4e0b\u8f7d\u94fe\u63a5 \u5b89\u88c5torch_npu\u4f9d\u8d56 \u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\u4f9d\u8d56\u3002 pip3 install pyyaml &hellip; <a href=\"http:\/\/madapapa.com\/wordpress\/?p=784\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">\u534e\u4e3aAscend NPU\u9002\u914d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"footnotes":""},"categories":[48,5],"tags":[],"class_list":["post-784","post","type-post","status-publish","format-standard","hentry","category-artificial-intelligence","category-linux"],"_links":{"self":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/784","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=784"}],"version-history":[{"count":1,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/784\/revisions"}],"predecessor-version":[{"id":785,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/784\/revisions\/785"}],"wp:attachment":[{"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=784"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/madapapa.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}