# PyTorch Operator Development Guide - [PyTorch Operator Development Guide](#pytorch-operator-development-guide) - [Overview](#overview) - [Operator Development Process](#operator-development-process) - [Operator Development Preparations](#operator-development-preparations) - [Setting Up the Environment](#setting-up-the-environment) - [Looking Up Operators](#looking-up-operators) - [Operator Adaptation](#operator-adaptation) - [Prerequisites](#prerequisites) - [Obtaining the PyTorch Source Code](#obtaining-the-pytorch-source-code) - [Registering an Operator](#registering-an-operator) - [Overview](#overview-1) - [Registering an Operator for PyTorch 1.8.1](#registering-an-operator-for-pytorch-181) - [Registering an Operator](#registering-an-operator-1) - [Examples](#examples) - [Developing an Operator Adaptation Plugin](#developing-an-operator-adaptation-plugin) - [Overview](#overview-2) - [Introduction to the npu_native_functions.yaml File](#introduction-to-the-npu_native_functionsyaml-file) - [Adaptation Plugin Implementation](#adaptation-plugin-implementation) - [Examples](#examples-1) - [Compiling and Installing the PyTorch Plugin](#compiling-and-installing-the-pytorch-plugin) - [Compiling the PyTorch Plugin](#compiling-the-pytorch-plugin) - [Installing the PyTorch Plugin](#installing-the-pytorch-plugin) - [Operator Function Verification](#operator-function-verification) - [Overview](#overview-3) - [Introduction](#introduction) - [Test Cases and Records](#test-cases-and-records) - [Implementation](#implementation) - [Introduction](#introduction-1) - [Procedure](#procedure) - [FAQs](#faqs) - [Pillow==5.3.0 Installation Failed](#pillow530-installation-failed) - [pip3.7 install torchvision Installation Failed](#pip37-install-torchvision-installation-failed) - ["torch 1.5.0xxxx" and "torchvision" Do Not Match When torch-\*.whl Is Installed](#torch-150xxxx-and-torchvision-do-not-match-when-torch-whl-is-installed) - [How Do I View Test Run Logs?](#how-do-i-view-test-run-logs) - [Why Cannot the Custom TBE Operator Be Called?](#why-cannot-the-custom-tbe-operator-be-called) - [How Do I Determine Whether the TBE Operator Is Correctly Called for PyTorch Adaptation?](#how-do-i-determine-whether-the-tbe-operator-is-correctly-called-for-pytorch-adaptation) - [PyTorch Compilation Fails and the Message "error: ld returned 1 exit status" Is Displayed](#pytorch-compilation-fails-and-the-message-error-ld-returned-1-exit-status-is-displayed) - [PyTorch Compilation Fails and the Message "error: call of overload...." Is Displayed](#pytorch-compilation-fails-and-the-message-error-call-of-overload-is-displayed) - [Appendixes](#appendixes) - [Installing CMake](#installing-cmake) - [Exporting a Custom Operator](#exporting-a-custom-operator) ### Overview To enable the PyTorch deep learning framework to run on Ascend AI Processors, you need to use Tensor Boost Engine (TBE) to customize the framework operators. ## Operator Development Process PyTorch operator development includes TBE operator development and operator adaptation to the PyTorch framework. 1. TBE operator development: If an operator on your network is incompatible with the Ascend AI Software Stack, you need to develop a TBE operator and then adapt it to the PyTorch framework. For details about the TBE operator development process and methods, see the _CANN TBE Custom Operator Development Guide_. 2. Operator adaptation to the PyTorch framework: If a TBE operator has been developed and is compatible with the Ascend AI Software Stack, you can directly adapt it to the PyTorch framework. The following figure shows the operator adaptation process in the PyTorch framework. **Figure 1** Operator adaptation process in the PyTorch framework  **Table 1** Description of the operator development process