--- id: torch-npu version: "2.12.0" license: BSD License license_treatment: permissive maintenance: active --- # torch-npu — NPU bridge for PyTorch License: permissive · Maintenance: active · Downloads: 817.2K/mo ## 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 above — verify before relying. Enables PyTorch to run computations on Huawei Ascend NPU hardware, bridging PyTorch's tensor operations to Ascend AI Processors. 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 pip install torch-npu uv add torch-npu poetry add torch-npu ## Installing torch-npu 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. 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) 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. 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: unspecified - Install friction: medium - Maintenance: active - Downloads: 817.2K/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags pytorch ascend npu acceleration, huawei npu pytorch backend, ascend processor pytorch support, npu tensor computation pytorch, pytorch hardware acceleration ascend, ascend ai processor pytorch, npu device pytorch bridge, hardware-acceleration, ascend-npu, pytorch-extension [View on SkillFed](https://skillfed.io/packages/torch-npu) · [View on PyPI](https://pypi.org/project/torch-npu/)