Skip to content

[WIP] Add Ascend NPU entry#2080

Draft
KarhouTam wants to merge 7 commits into
pytorch:sitefrom
KarhouTam:ascend-npu
Draft

[WIP] Add Ascend NPU entry#2080
KarhouTam wants to merge 7 commits into
pytorch:sitefrom
KarhouTam:ascend-npu

Conversation

@KarhouTam

Copy link
Copy Markdown

Description

Add Ascend NPU as an additional platform

cc @fffrog @can-gaa-hou @zeshengzong

@netlify

netlify Bot commented Jun 10, 2026

Copy link
Copy Markdown

Deploy Preview for pytorch-dot-org-preview ready!

Name Link
🔨 Latest commit a747ff6
🔍 Latest deploy log https://app.netlify.com/projects/pytorch-dot-org-preview/deploys/6a4e1f1a70ef26000801d7d2
😎 Deploy Preview https://deploy-preview-2080--pytorch-dot-org-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread _additional_platforms/ascend_npu.json Outdated
Comment on lines +25 to +30
After installation, source the CANN environment:

```bash
source <ASCEND_INSTALL_DIR>/Ascend/cann/set_env.sh
source <ASCEND_INSTALL_DIR>/Ascend/nnal/atb/set_env.sh
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is CANN installation steps, not for torch-npu. Should be pip install torch-npu here. Please refer to https://www.hiascend.com/developer/software/ai-frameworks/pytorch/download?versionId=167&ids=26958bcc909e4cd48fa56d4c4a43ebec%2C98%2C106%2C1%2C6%2C3%2C

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. Fixed.

Comment on lines +29 to +49
```python
import torch
import torch_npu

print(torch.__version__)
print("torch_npu version:", torch_npu.__version__)

if torch.npu.is_available():
print("Ascend NPU is available!")
print(f"NPU count: {torch_npu.npu.device_count()}")
print(f"NPU name: {torch_npu.npu.get_device_name(0)}")

# Test basic computation
a = torch.randn(3, 4).npu()
b = torch.randn(3, 4).npu()
print("NPU computation result:", a + b)
else:
print("Ascend NPU is not available.")
```

Expected output should show the PyTorch and torch_npu versions, NPU count, device name, and the result of a tensor addition without errors.

@can-gaa-hou can-gaa-hou Jul 8, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
```python
import torch
import torch_npu
print(torch.__version__)
print("torch_npu version:", torch_npu.__version__)
if torch.npu.is_available():
print("Ascend NPU is available!")
print(f"NPU count: {torch_npu.npu.device_count()}")
print(f"NPU name: {torch_npu.npu.get_device_name(0)}")
# Test basic computation
a = torch.randn(3, 4).npu()
b = torch.randn(3, 4).npu()
print("NPU computation result:", a + b)
else:
print("Ascend NPU is not available.")
```
Expected output should show the PyTorch and torch_npu versions, NPU count, device name, and the result of a tensor addition without errors.
```python
import torch
import torch_npu
x = torch.randn(2, 2).npu()
y = torch.randn(2, 2).npu()
z = x.mm(y)
print(z)
```
The following similar output indicates successful installation:
```bash
tensor([[-0.0515, 0.3664],
[-0.1258, -0.5425]], device='npu:0')
```

@@ -0,0 +1,58 @@
# Installing on Ascend NPU

Ascend NPU is Huawei's AI processor series. The Ascend Extension for PyTorch (`torch_npu`) enables PyTorch to run on Ascend NPUs, supporting eager-mode execution, distributed training, and mixed precision via the `PrivateUse1` backend.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ascend NPU is Huawei's AI processor series. The Ascend Extension for PyTorch (`torch_npu`) enables PyTorch to run on Ascend NPUs, supporting eager-mode execution, distributed training, and mixed precision via the `PrivateUse1` backend.
**Ascend for PyTorch (`torch-npu`)** is a deep learning adaptation framework built on Ascend. It enables Ascend NPUs to support the PyTorch framework, delivering the powerful computing capabilities of Ascend AI processors to PyTorch developers and users.

Comment thread _additional_platforms/ascend_npu.json Outdated
"name": "Ascend NPU",
"support_channel": "https://github.com/Ascend/pytorch/issues",
"stable": {
"linux": "pip3 install torch torchvision && pip3 install torch-npu"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"linux": "pip3 install torch torchvision && pip3 install torch-npu"
"linux": "pip3 install torch==2.10.0 --index-url https://download.pytorch.org/whl/cpu && pip3 install torch-npu==2.10.0"


### Hardware Requirements

* Huawei Ascend NPU(s), for example, 910B, 910C, or 310P processor

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Huawei Ascend NPU(s), for example, 910B, 910C, or 310P processor
* Ascend for PyTorch supports most Ascend platforms. Please check the [hardware compatibility](https://www.hiascend.com/hardware/compatibility) before installing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants