torch-npu
NPU bridge for PyTorch
Decision gist · record as of 2026-08-14
Yes, if you have Ascend NPU hardware or access to an Ascend environment and want to run PyTorch workloads on it. The package is actively maintained, permissively licensed, and integrates cleanly with PyTorch's API. No if you lack Ascend hardware or CANN software—it will not run on CPU or other accelerators. Verify CANN availability and compatibility with your system before installing.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires CANN (Ascend Auxiliary Software) to be installed and initialized via source /usr/local/Ascend/ascend-toolkit/set_env.sh; Ascend NPU hardware or emulation environment must be available.
- Medium friction: requires torch 2.12.0 as a runtime dependency and CANN (Ascend Auxiliary Software) pre-installed on the system.
- Wheels are available for Python 3.10–3.13 on x86_64 and aarch64 Linux.
License · maintenance · safety
BSD License (permissive) — BSD License (permissive) allows commercial and private use with minimal restrictions; attribution required.
last release 2026-07-27 (18 days)
0 known vulnerabilities (OSV.dev, 2026-08-14) · 817,171 downloads/mo, #4,987 on PyPI
Alternatives
Verify before relying
# Install PyTorch 2.12.0 first, then torch-npu
pip install torch==2.12.0 --index-url https://download.pytorch.org/whl/cpu
pip install torch-npu==2.12.0rc1
# Use Ascend NPU for tensor operations
import torch
x = torch.randn(2, 2).npu()
y = torch.randn(2, 2).npu()
z = x.mm(y)
print(z)- Whether CANN installation is straightforward or requires specialized knowledge for most developers.
- Performance characteristics and typical speedup factors compared to CPU PyTorch on Ascend hardware.
- Compatibility of existing PyTorch models and whether code changes beyond .npu() calls are typically needed.
What it is and what it does
torch-npu is a PyTorch extension that adapts Huawei Ascend NPU hardware to work with PyTorch's standard tensor API. It allows developers to move tensors and operations to Ascend processors using familiar PyTorch syntax (e.g., `.npu()` to move a tensor to NPU), without rewriting core model logic. The package acts as a bridge between PyTorch's compute graph and Ascend's hardware capabilities.
The extension requires PyTorch 2.12.0 and the CANN software stack to be pre-installed on a Linux system (x86_64 or aarch64). Installation is straightforward via pip once dependencies are in place, and the package is actively maintained with recent releases. It targets developers who have access to Ascend hardware and want to leverage it for AI workloads without switching away from PyTorch.
Use it for
- Accelerate deep learning training and inference on Ascend NPU hardware without rewriting PyTorch model code.
- Deploy PyTorch models to Huawei Ascend-based data centers or edge devices for production inference.
- Evaluate Ascend hardware performance for AI workloads by running existing PyTorch experiments on NPU.
- Build AI applications targeting Ascend infrastructure in enterprise or cloud environments.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you have Ascend NPU hardware or access to an Ascend environment and want to run PyTorch workloads on it.
The package is actively maintained, permissively licensed, and integrates cleanly with PyTorch's API. No if you lack Ascend hardware or CANN software—it will not run on CPU or other accelerators. Verify CANN availability and compatibility with your system before installing.
Install
torch-npu on PyPI
Before you install
Medium friction: requires torch 2.12.0 as a runtime dependency and CANN (Ascend Auxiliary Software) pre-installed on the system. Wheels are available for Python 3.10–3.13 on x86_64 and aarch64 Linux. Active maintenance with a release 18 days old.
Requires CANN (Ascend Auxiliary Software) to be installed and initialized via source /usr/local/Ascend/ascend-toolkit/set_env.sh; Ascend NPU hardware or emulation environment must be available.
License in practice
BSD License (permissive) allows commercial and private use with minimal restrictions; attribution required.
Quickstart
# Install PyTorch 2.12.0 first, then torch-npu
pip install torch==2.12.0 --index-url https://download.pytorch.org/whl/cpu
pip install torch-npu==2.12.0rc1
# Use Ascend NPU for tensor operations
import torch
x = torch.randn(2, 2).npu()
y = torch.randn(2, 2).npu()
z = x.mm(y)
print(z)
Verify before relying
- Whether CANN installation is straightforward or requires specialized knowledge for most developers.
- Performance characteristics and typical speedup factors compared to CPU PyTorch on Ascend hardware.
- Compatibility of existing PyTorch models and whether code changes beyond .npu() calls are typically needed.
Package facts
| License | BSD License permissive |
| Python support | Not specified |
| Install friction | Medium. Platform-specific wheel |
| Runtime dependencies | 1 packagetorch |
| Maintenance | Actively maintained 18 days since the last release |
| First released | |
| Downloads | 817,171 / month, #4,987 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: POSIX :: LinuxProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/EngineeringTopic :: Scientific/Engineering :: Artificial IntelligenceTopic :: Scientific/Engineering :: MathematicsTopic :: Software DevelopmentTopic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: torch_npu-2.12.0-cp310-cp310-manylinux_2_28_aarch64.whl; torch_npu-2.12.0-cp310-cp310-manylinux_2_28_x86_64.whl; torch_npu-2.12.0-cp311-cp311-manylinux_2_28_aarch64.whl; torch_npu-2.12.0-cp311-cp311-manylinux_2_28_x86_64.whl; torch_npu-2.12.0-cp312-cp312-manylinux_2_28_aarch64.whl; torch_npu-2.12.0-cp312-cp312-manylinux_2_28_x86_64.whl; torch_npu-2.12.0-cp313-cp313-manylinux_2_28_aarch64.whl; torch_npu-2.12.0-cp313-cp313-manylinux_2_28_x86_64.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pytorch ascend npu acceleration”
- torch-npuEnables PyTorch to run computations on Huawei Ascend NPU hardware,…
- liger-kernelLiger Kernel provides optimized Triton kernels for LLM training,…
- ipex-llmAccelerates large language model inference on Intel hardware (GPU,…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also torch · torchao · pte-adapter-model-explorer · hoptorch · litert-torch · triton-ascend · executorch · pytorch · torchcodec · torch-einops-utils