Rate this Page

IRs#

Created On: Dec 16, 2025 | Last Updated On: Dec 16, 2025

PyTorch 2.0 offers two set of IRs for backends to interface with: Core ATen IR and Prims IR.

Core ATen IR#

Core aten ops is the core subset of aten operators that can be used to compose other operators. Core aten IR is fully functional, and there is no inplace or _out variants in this opset. In contrast to Prims IR, core aten ops reuses the existing aten ops in “native_functions.yaml”, and it doesn’t further decompose ops into explicit type promotion and broadcasting ops. This opset is designed to serve as the functional IR to interface with backends.

Warning

This opset is still under active development, more ops will be added in the future.

Prims IR#

Prims IR is a set of primitive operators that can be used to compose other operators. Prims IR is a lower level opset than core aten IR, and it further decomposes ops into explicit type promotion and broadcasting ops: prims.convert_element_type and prims.broadcast_in_dim. This opset is designed to interface with compiler backends.

Warning

This opset is still under active development, more ops will be added in the future.

Glossary Terms Demo#

This section demonstrates tooltips for various glossary terms. Hover over the highlighted terms to see their definitions.

Operations#

An Operation is a unit of work in PyTorch. There are different types of operations:

Kernels#

A Kernel is the implementation of a PyTorch operation. There are two main types:

JIT Compilation#

PyTorch supports JIT (Just-In-Time) compilation through TorchScript. There are two main approaches:

  1. Tracing: Using torch.jit.trace on a function to get an executable that can be optimized

  2. Scripting: Using torch.jit.script to inspect source code and compile it as TorchScript code

Summary Table#

Term

Type

Description

ATen

Library

Foundational tensor library

Operation

Concept

Unit of work

Kernel

Implementation

What happens when an operation executes

JIT

Technique

Just-In-Time Compilation

TorchScript

Interface

JIT compiler and interpreter

Intersphinx References#

Note: Intersphinx tooltips only work with documentation hosted on Read the Docs that has the embed API enabled. Most external documentation sites (docs.python.org, docs.pytorch.org, numpy.org) do not support this feature.

The following are standard intersphinx links (clickable but without tooltips):